Bug 24387: DBIC schema changes
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 16 Jul 2021 07:13:34 +0000 (09:13 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 16 Aug 2021 09:55:55 +0000 (11:55 +0200)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Schema/Result/AdditionalContent.pm [new file with mode: 0644]
Koha/Schema/Result/Borrower.pm
Koha/Schema/Result/Branch.pm
Koha/Schema/Result/OpacNews.pm [deleted file]

diff --git a/Koha/Schema/Result/AdditionalContent.pm b/Koha/Schema/Result/AdditionalContent.pm
new file mode 100644 (file)
index 0000000..080af4a
--- /dev/null
@@ -0,0 +1,257 @@
+use utf8;
+package Koha::Schema::Result::AdditionalContent;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+Koha::Schema::Result::AdditionalContent
+
+=cut
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Core';
+
+=head1 TABLE: C<additional_contents>
+
+=cut
+
+__PACKAGE__->table("additional_contents");
+
+=head1 ACCESSORS
+
+=head2 idnew
+
+  data_type: 'integer'
+  extra: {unsigned => 1}
+  is_auto_increment: 1
+  is_nullable: 0
+
+unique identifier for the additional content
+
+=head2 category
+
+  data_type: 'varchar'
+  is_nullable: 0
+  size: 20
+
+category for the additional content
+
+=head2 code
+
+  data_type: 'varchar'
+  is_nullable: 0
+  size: 20
+
+code to group content per lang
+
+=head2 location
+
+  data_type: 'varchar'
+  is_nullable: 0
+  size: 255
+
+location of the additional content
+
+=head2 branchcode
+
+  data_type: 'varchar'
+  is_foreign_key: 1
+  is_nullable: 1
+  size: 10
+
+branch code users to create branch specific additional content, NULL is every branch.
+
+=head2 title
+
+  data_type: 'varchar'
+  default_value: (empty string)
+  is_nullable: 0
+  size: 250
+
+title of the additional content
+
+=head2 content
+
+  data_type: 'mediumtext'
+  is_nullable: 0
+
+the body of your additional content
+
+=head2 lang
+
+  data_type: 'varchar'
+  default_value: (empty string)
+  is_nullable: 0
+  size: 25
+
+location for the additional content(koha is the staff interface, slip is the circulation receipt and language codes are for the opac)
+
+=head2 published_on
+
+  data_type: 'date'
+  datetime_undef_if_invalid: 1
+  is_nullable: 1
+
+publication date
+
+=head2 updated_on
+
+  data_type: 'timestamp'
+  datetime_undef_if_invalid: 1
+  default_value: current_timestamp
+  is_nullable: 0
+
+last modification
+
+=head2 expirationdate
+
+  data_type: 'date'
+  datetime_undef_if_invalid: 1
+  is_nullable: 1
+
+date the additional content is set to expire or no longer be visible
+
+=head2 number
+
+  data_type: 'integer'
+  is_nullable: 1
+
+the order in which this additional content appears in that specific location
+
+=head2 borrowernumber
+
+  data_type: 'integer'
+  is_foreign_key: 1
+  is_nullable: 1
+
+The user who created the additional content
+
+=cut
+
+__PACKAGE__->add_columns(
+  "idnew",
+  {
+    data_type => "integer",
+    extra => { unsigned => 1 },
+    is_auto_increment => 1,
+    is_nullable => 0,
+  },
+  "category",
+  { data_type => "varchar", is_nullable => 0, size => 20 },
+  "code",
+  { data_type => "varchar", is_nullable => 0, size => 20 },
+  "location",
+  { data_type => "varchar", is_nullable => 0, size => 255 },
+  "branchcode",
+  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
+  "title",
+  { data_type => "varchar", default_value => "", is_nullable => 0, size => 250 },
+  "content",
+  { data_type => "mediumtext", is_nullable => 0 },
+  "lang",
+  { data_type => "varchar", default_value => "", is_nullable => 0, size => 25 },
+  "published_on",
+  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
+  "updated_on",
+  {
+    data_type => "timestamp",
+    datetime_undef_if_invalid => 1,
+    default_value => \"current_timestamp",
+    is_nullable => 0,
+  },
+  "expirationdate",
+  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
+  "number",
+  { data_type => "integer", is_nullable => 1 },
+  "borrowernumber",
+  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</idnew>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("idnew");
+
+=head1 UNIQUE CONSTRAINTS
+
+=head2 C<additional_contents_uniq>
+
+=over 4
+
+=item * L</category>
+
+=item * L</code>
+
+=item * L</branchcode>
+
+=item * L</lang>
+
+=back
+
+=cut
+
+__PACKAGE__->add_unique_constraint(
+  "additional_contents_uniq",
+  ["category", "code", "branchcode", "lang"],
+);
+
+=head1 RELATIONS
+
+=head2 borrowernumber
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Borrower>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "borrowernumber",
+  "Koha::Schema::Result::Borrower",
+  { borrowernumber => "borrowernumber" },
+  {
+    is_deferrable => 1,
+    join_type     => "LEFT",
+    on_delete     => "SET NULL",
+    on_update     => "CASCADE",
+  },
+);
+
+=head2 branchcode
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Branch>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "branchcode",
+  "Koha::Schema::Result::Branch",
+  { branchcode => "branchcode" },
+  {
+    is_deferrable => 1,
+    join_type     => "LEFT",
+    on_delete     => "CASCADE",
+    on_update     => "CASCADE",
+  },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-07-16 07:12:03
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0HtqQpArwFtGrsivukyG1Q
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+1;
index 68abbc1..f0332fc 100644 (file)
@@ -869,6 +869,21 @@ __PACKAGE__->has_many(
   { cascade_copy => 0, cascade_delete => 0 },
 );
 
+=head2 additional_contents
+
+Type: has_many
+
+Related object: L<Koha::Schema::Result::AdditionalContent>
+
+=cut
+
+__PACKAGE__->has_many(
+  "additional_contents",
+  "Koha::Schema::Result::AdditionalContent",
+  { "foreign.borrowernumber" => "self.borrowernumber" },
+  { cascade_copy => 0, cascade_delete => 0 },
+);
+
 =head2 advanced_editor_macros
 
 Type: has_many
@@ -1439,21 +1454,6 @@ __PACKAGE__->has_many(
   { cascade_copy => 0, cascade_delete => 0 },
 );
 
-=head2 opac_news
-
-Type: has_many
-
-Related object: L<Koha::Schema::Result::OpacNews>
-
-=cut
-
-__PACKAGE__->has_many(
-  "opac_news",
-  "Koha::Schema::Result::OpacNews",
-  { "foreign.borrowernumber" => "self.borrowernumber" },
-  { cascade_copy => 0, cascade_delete => 0 },
-);
-
 =head2 patron_consents
 
 Type: has_many
@@ -1875,8 +1875,8 @@ Composing rels: L</aqorder_users> -> ordernumber
 __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber");
 
 
-# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-07-12 13:40:00
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IKPb4912o8oCHtmFAi6FPQ
+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-07-16 07:12:03
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SWOGE6/WDsjzXcgfxmVQ4A
 
 __PACKAGE__->add_columns(
     '+anonymized'    => { is_boolean => 1 },
index 87f4ec1..500d100 100644 (file)
@@ -301,6 +301,21 @@ __PACKAGE__->has_many(
   { cascade_copy => 0, cascade_delete => 0 },
 );
 
+=head2 additional_contents
+
+Type: has_many
+
+Related object: L<Koha::Schema::Result::AdditionalContent>
+
+=cut
+
+__PACKAGE__->has_many(
+  "additional_contents",
+  "Koha::Schema::Result::AdditionalContent",
+  { "foreign.branchcode" => "self.branchcode" },
+  { cascade_copy => 0, cascade_delete => 0 },
+);
+
 =head2 aqbaskets
 
 Type: has_many
@@ -721,21 +736,6 @@ __PACKAGE__->might_have(
   { cascade_copy => 0, cascade_delete => 0 },
 );
 
-=head2 opac_news
-
-Type: has_many
-
-Related object: L<Koha::Schema::Result::OpacNews>
-
-=cut
-
-__PACKAGE__->has_many(
-  "opac_news",
-  "Koha::Schema::Result::OpacNews",
-  { "foreign.branchcode" => "self.branchcode" },
-  { cascade_copy => 0, cascade_delete => 0 },
-);
-
 =head2 problem_reports
 
 Type: has_many
@@ -887,8 +887,8 @@ __PACKAGE__->has_many(
 );
 
 
-# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Uu8m3hyDhM50oTSeNTJbdg
+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-07-16 07:12:03
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EZYvCbpv41QSEhHRPVFImA
 
 __PACKAGE__->add_columns(
     '+pickup_location' => { is_boolean => 1 }
diff --git a/Koha/Schema/Result/OpacNews.pm b/Koha/Schema/Result/OpacNews.pm
deleted file mode 100644 (file)
index fc86e19..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-use utf8;
-package Koha::Schema::Result::OpacNews;
-
-# Created by DBIx::Class::Schema::Loader
-# DO NOT MODIFY THE FIRST PART OF THIS FILE
-
-=head1 NAME
-
-Koha::Schema::Result::OpacNews
-
-=cut
-
-use strict;
-use warnings;
-
-use base 'DBIx::Class::Core';
-
-=head1 TABLE: C<opac_news>
-
-=cut
-
-__PACKAGE__->table("opac_news");
-
-=head1 ACCESSORS
-
-=head2 idnew
-
-  data_type: 'integer'
-  extra: {unsigned => 1}
-  is_auto_increment: 1
-  is_nullable: 0
-
-unique identifier for the news article
-
-=head2 branchcode
-
-  data_type: 'varchar'
-  is_foreign_key: 1
-  is_nullable: 1
-  size: 10
-
-branch code users to create branch specific news, NULL is every branch.
-
-=head2 title
-
-  data_type: 'varchar'
-  default_value: (empty string)
-  is_nullable: 0
-  size: 250
-
-title of the news article
-
-=head2 content
-
-  data_type: 'mediumtext'
-  is_nullable: 0
-
-the body of your news article
-
-=head2 lang
-
-  data_type: 'varchar'
-  default_value: (empty string)
-  is_nullable: 0
-  size: 50
-
-location for the article (koha is the staff interface, slip is the circulation receipt and language codes are for the opac)
-
-=head2 published_on
-
-  data_type: 'date'
-  datetime_undef_if_invalid: 1
-  is_nullable: 1
-
-publication date
-
-=head2 updated_on
-
-  data_type: 'timestamp'
-  datetime_undef_if_invalid: 1
-  default_value: current_timestamp
-  is_nullable: 0
-
-last modification
-
-=head2 expirationdate
-
-  data_type: 'date'
-  datetime_undef_if_invalid: 1
-  is_nullable: 1
-
-date the article is set to expire or no longer be visible
-
-=head2 number
-
-  data_type: 'integer'
-  is_nullable: 1
-
-the order in which this article appears in that specific location
-
-=head2 borrowernumber
-
-  data_type: 'integer'
-  is_foreign_key: 1
-  is_nullable: 1
-
-The user who created the news article
-
-=cut
-
-__PACKAGE__->add_columns(
-  "idnew",
-  {
-    data_type => "integer",
-    extra => { unsigned => 1 },
-    is_auto_increment => 1,
-    is_nullable => 0,
-  },
-  "branchcode",
-  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
-  "title",
-  { data_type => "varchar", default_value => "", is_nullable => 0, size => 250 },
-  "content",
-  { data_type => "mediumtext", is_nullable => 0 },
-  "lang",
-  { data_type => "varchar", default_value => "", is_nullable => 0, size => 50 },
-  "published_on",
-  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
-  "updated_on",
-  {
-    data_type => "timestamp",
-    datetime_undef_if_invalid => 1,
-    default_value => \"current_timestamp",
-    is_nullable => 0,
-  },
-  "expirationdate",
-  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
-  "number",
-  { data_type => "integer", is_nullable => 1 },
-  "borrowernumber",
-  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
-);
-
-=head1 PRIMARY KEY
-
-=over 4
-
-=item * L</idnew>
-
-=back
-
-=cut
-
-__PACKAGE__->set_primary_key("idnew");
-
-=head1 RELATIONS
-
-=head2 borrowernumber
-
-Type: belongs_to
-
-Related object: L<Koha::Schema::Result::Borrower>
-
-=cut
-
-__PACKAGE__->belongs_to(
-  "borrowernumber",
-  "Koha::Schema::Result::Borrower",
-  { borrowernumber => "borrowernumber" },
-  {
-    is_deferrable => 1,
-    join_type     => "LEFT",
-    on_delete     => "SET NULL",
-    on_update     => "CASCADE",
-  },
-);
-
-=head2 branchcode
-
-Type: belongs_to
-
-Related object: L<Koha::Schema::Result::Branch>
-
-=cut
-
-__PACKAGE__->belongs_to(
-  "branchcode",
-  "Koha::Schema::Result::Branch",
-  { branchcode => "branchcode" },
-  {
-    is_deferrable => 1,
-    join_type     => "LEFT",
-    on_delete     => "CASCADE",
-    on_update     => "CASCADE",
-  },
-);
-
-
-# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Edd8K7ANL49fG7FKjwyRVQ
-
-sub koha_object_class {
-    'Koha::NewsItem';
-}
-sub koha_objects_class {
-    'Koha::News';
-}
-
-1;