Bug 22343: Add new tables schema file
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 28 Jul 2020 12:52:32 +0000 (09:52 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 2 Oct 2020 08:54:40 +0000 (10:54 +0200)
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Schema/Result/LibrarySmtpServer.pm [new file with mode: 0644]
Koha/Schema/Result/SmtpServer.pm [new file with mode: 0644]

diff --git a/Koha/Schema/Result/LibrarySmtpServer.pm b/Koha/Schema/Result/LibrarySmtpServer.pm
new file mode 100644 (file)
index 0000000..eaf34fe
--- /dev/null
@@ -0,0 +1,120 @@
+use utf8;
+package Koha::Schema::Result::LibrarySmtpServer;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+Koha::Schema::Result::LibrarySmtpServer
+
+=cut
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Core';
+
+=head1 TABLE: C<library_smtp_servers>
+
+=cut
+
+__PACKAGE__->table("library_smtp_servers");
+
+=head1 ACCESSORS
+
+=head2 id
+
+  data_type: 'integer'
+  is_auto_increment: 1
+  is_nullable: 0
+
+=head2 library_id
+
+  data_type: 'varchar'
+  is_foreign_key: 1
+  is_nullable: 0
+  size: 10
+
+=head2 smtp_server_id
+
+  data_type: 'integer'
+  is_foreign_key: 1
+  is_nullable: 0
+
+=cut
+
+__PACKAGE__->add_columns(
+  "id",
+  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
+  "library_id",
+  { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 },
+  "smtp_server_id",
+  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</id>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("id");
+
+=head1 UNIQUE CONSTRAINTS
+
+=head2 C<library_id_idx>
+
+=over 4
+
+=item * L</library_id>
+
+=back
+
+=cut
+
+__PACKAGE__->add_unique_constraint("library_id_idx", ["library_id"]);
+
+=head1 RELATIONS
+
+=head2 library
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Branch>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "library",
+  "Koha::Schema::Result::Branch",
+  { branchcode => "library_id" },
+  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
+);
+
+=head2 smtp_server
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::SmtpServer>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "smtp_server",
+  "Koha::Schema::Result::SmtpServer",
+  { id => "smtp_server_id" },
+  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-08-24 13:41:24
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qKAQAs3VFcitIGDGra/zuw
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+1;
diff --git a/Koha/Schema/Result/SmtpServer.pm b/Koha/Schema/Result/SmtpServer.pm
new file mode 100644 (file)
index 0000000..6761c21
--- /dev/null
@@ -0,0 +1,158 @@
+use utf8;
+package Koha::Schema::Result::SmtpServer;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+Koha::Schema::Result::SmtpServer
+
+=cut
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Core';
+
+=head1 TABLE: C<smtp_servers>
+
+=cut
+
+__PACKAGE__->table("smtp_servers");
+
+=head1 ACCESSORS
+
+=head2 id
+
+  data_type: 'integer'
+  is_auto_increment: 1
+  is_nullable: 0
+
+=head2 name
+
+  data_type: 'varchar'
+  is_nullable: 0
+  size: 80
+
+=head2 host
+
+  data_type: 'varchar'
+  default_value: 'localhost'
+  is_nullable: 0
+  size: 80
+
+=head2 port
+
+  data_type: 'integer'
+  default_value: 25
+  is_nullable: 0
+
+=head2 timeout
+
+  data_type: 'integer'
+  default_value: 120
+  is_nullable: 0
+
+=head2 ssl_mode
+
+  data_type: 'enum'
+  extra: {list => ["disabled","ssl","starttls"]}
+  is_nullable: 0
+
+=head2 user_name
+
+  data_type: 'varchar'
+  is_nullable: 1
+  size: 80
+
+=head2 password
+
+  data_type: 'varchar'
+  is_nullable: 1
+  size: 80
+
+=head2 debug
+
+  data_type: 'tinyint'
+  default_value: 0
+  is_nullable: 0
+
+=cut
+
+__PACKAGE__->add_columns(
+  "id",
+  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
+  "name",
+  { data_type => "varchar", is_nullable => 0, size => 80 },
+  "host",
+  {
+    data_type => "varchar",
+    default_value => "localhost",
+    is_nullable => 0,
+    size => 80,
+  },
+  "port",
+  { data_type => "integer", default_value => 25, is_nullable => 0 },
+  "timeout",
+  { data_type => "integer", default_value => 120, is_nullable => 0 },
+  "ssl_mode",
+  {
+    data_type => "enum",
+    extra => { list => ["disabled", "ssl", "starttls"] },
+    is_nullable => 0,
+  },
+  "user_name",
+  { data_type => "varchar", is_nullable => 1, size => 80 },
+  "password",
+  { data_type => "varchar", is_nullable => 1, size => 80 },
+  "debug",
+  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</id>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("id");
+
+=head1 RELATIONS
+
+=head2 library_smtp_servers
+
+Type: has_many
+
+Related object: L<Koha::Schema::Result::LibrarySmtpServer>
+
+=cut
+
+__PACKAGE__->has_many(
+  "library_smtp_servers",
+  "Koha::Schema::Result::LibrarySmtpServer",
+  { "foreign.smtp_server_id" => "self.id" },
+  { cascade_copy => 0, cascade_delete => 0 },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-08-21 18:02:08
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OpyR6JhcwWKQP2+hyaLiww
+
+__PACKAGE__->add_columns(
+    '+debug' => { is_boolean => 1 }
+);
+
+sub koha_objects_class {
+    'Koha::SMTP::Servers';
+}
+
+sub koha_object_class {
+    'Koha::SMTP::Server';
+}
+
+1;