From 7db1e6c11ea5c405b2b9cf10c3ed9e7708017afc Mon Sep 17 00:00:00 2001
From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Date: Wed, 28 Jun 2023 13:02:05 +0000
Subject: [PATCH] Bug 33537: [DBIx] Schema changes for mail_domain_limits
Content-Type: text/plain; charset=utf-8

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
---
 Koha/Schema/Result/MailDomainLimit.pm | 155 ++++++++++++++++++++++++++
 1 file changed, 155 insertions(+)
 create mode 100644 Koha/Schema/Result/MailDomainLimit.pm

diff --git a/Koha/Schema/Result/MailDomainLimit.pm b/Koha/Schema/Result/MailDomainLimit.pm
new file mode 100644
index 0000000000..f47ad38d5a
--- /dev/null
+++ b/Koha/Schema/Result/MailDomainLimit.pm
@@ -0,0 +1,155 @@
+use utf8;
+package Koha::Schema::Result::MailDomainLimit;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+Koha::Schema::Result::MailDomainLimit
+
+=cut
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Core';
+
+=head1 TABLE: C<mail_domain_limits>
+
+=cut
+
+__PACKAGE__->table("mail_domain_limits");
+
+=head1 ACCESSORS
+
+=head2 id
+
+  data_type: 'integer'
+  is_auto_increment: 1
+  is_nullable: 0
+
+=head2 domain_name
+
+  data_type: 'tinytext'
+  is_nullable: 0
+
+=head2 domain_limit
+
+  data_type: 'integer'
+  is_nullable: 1
+
+=head2 units
+
+  data_type: 'integer'
+  is_nullable: 1
+
+=head2 unit_type
+
+  data_type: 'enum'
+  extra: {list => ["minutes","hours","days"]}
+  is_nullable: 1
+
+=head2 belongs_to
+
+  accessor: undef
+  data_type: 'integer'
+  is_foreign_key: 1
+  is_nullable: 1
+
+=cut
+
+__PACKAGE__->add_columns(
+  "id",
+  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
+  "domain_name",
+  { data_type => "tinytext", is_nullable => 0 },
+  "domain_limit",
+  { data_type => "integer", is_nullable => 1 },
+  "units",
+  { data_type => "integer", is_nullable => 1 },
+  "unit_type",
+  {
+    data_type => "enum",
+    extra => { list => ["minutes", "hours", "days"] },
+    is_nullable => 1,
+  },
+  "belongs_to",
+  {
+    accessor       => undef,
+    data_type      => "integer",
+    is_foreign_key => 1,
+    is_nullable    => 1,
+  },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</id>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("id");
+
+=head1 UNIQUE CONSTRAINTS
+
+=head2 C<mail_domain_limits_uniq1>
+
+=over 4
+
+=item * L</domain_name>
+
+=back
+
+=cut
+
+__PACKAGE__->add_unique_constraint("mail_domain_limits_uniq1", ["domain_name"]);
+
+=head1 RELATIONS
+
+=head2 belongs_to_rel
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::MailDomainLimit>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "belongs_to_rel",
+  "Koha::Schema::Result::MailDomainLimit",
+  { id => "belongs_to" },
+  {
+    is_deferrable => 1,
+    join_type     => "LEFT",
+    on_delete     => "CASCADE",
+    on_update     => "CASCADE",
+  },
+);
+
+=head2 mail_domain_limits
+
+Type: has_many
+
+Related object: L<Koha::Schema::Result::MailDomainLimit>
+
+=cut
+
+__PACKAGE__->has_many(
+  "mail_domain_limits",
+  "Koha::Schema::Result::MailDomainLimit",
+  { "foreign.belongs_to" => "self.id" },
+  { cascade_copy => 0, cascade_delete => 0 },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-07-03 08:44:06
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ua1qQTtFvrZGtMMBvsCaHg
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+1;
-- 
2.30.2