Bugzilla – Attachment 156268 Details for
Bug 31383
Additional contents: We need a parent and child table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31383: DBIC changes
Bug-31383-DBIC-changes.patch (text/plain), 7.48 KB, created by
Martin Renvoize (ashimema)
on 2023-09-27 10:01:29 UTC
(
hide
)
Description:
Bug 31383: DBIC changes
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-09-27 10:01:29 UTC
Size:
7.48 KB
patch
obsolete
>From 94f7e4e57912d0a92a08f4d2293ad0fdc71243a4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 28 Feb 2023 17:39:40 +0100 >Subject: [PATCH] Bug 31383: DBIC changes > >Sponsored-by: Rijksmuseum, Netherlands >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Schema/Result/AdditionalContent.pm | 64 +++----- > .../Result/AdditionalContentsLocalization.pm | 148 ++++++++++++++++++ > Koha/Schema/Result/Branch.pm | 4 +- > 3 files changed, 173 insertions(+), 43 deletions(-) > create mode 100644 Koha/Schema/Result/AdditionalContentsLocalization.pm > >diff --git a/Koha/Schema/Result/AdditionalContent.pm b/Koha/Schema/Result/AdditionalContent.pm >index 598f17ccc05..c559107ca79 100644 >--- a/Koha/Schema/Result/AdditionalContent.pm >+++ b/Koha/Schema/Result/AdditionalContent.pm >@@ -23,14 +23,14 @@ __PACKAGE__->table("additional_contents"); > > =head1 ACCESSORS > >-=head2 idnew >+=head2 id > > data_type: 'integer' > extra: {unsigned => 1} > is_auto_increment: 1 > is_nullable: 0 > >-unique identifier for the additional content >+unique identifier for the additional content category > > =head2 category > >@@ -65,31 +65,6 @@ location of the additional content > > 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: 50 >- >-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' >@@ -133,7 +108,7 @@ The user who created the additional content > =cut > > __PACKAGE__->add_columns( >- "idnew", >+ "id", > { > data_type => "integer", > extra => { unsigned => 1 }, >@@ -148,12 +123,6 @@ __PACKAGE__->add_columns( > { 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 => 50 }, > "published_on", > { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, > "updated_on", >@@ -175,13 +144,13 @@ __PACKAGE__->add_columns( > > =over 4 > >-=item * L</idnew> >+=item * L</id> > > =back > > =cut > >-__PACKAGE__->set_primary_key("idnew"); >+__PACKAGE__->set_primary_key("id"); > > =head1 UNIQUE CONSTRAINTS > >@@ -195,19 +164,32 @@ __PACKAGE__->set_primary_key("idnew"); > > =item * L</branchcode> > >-=item * L</lang> >- > =back > > =cut > > __PACKAGE__->add_unique_constraint( > "additional_contents_uniq", >- ["category", "code", "branchcode", "lang"], >+ ["category", "code", "branchcode"], > ); > > =head1 RELATIONS > >+=head2 additional_contents_localizations >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::AdditionalContentsLocalization> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "additional_contents_localizations", >+ "Koha::Schema::Result::AdditionalContentsLocalization", >+ { "foreign.additional_content_id" => "self.id" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 borrowernumber > > Type: belongs_to >@@ -249,8 +231,8 @@ __PACKAGE__->belongs_to( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-02-02 07:12:59 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/h/wWfmyVxW7skwrMn3scg >+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-03-03 07:19:57 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0w/fOUAy+4V4aVls/i7Wig > > > # You can replace this text with custom code or comments, and it will be preserved on regeneration >diff --git a/Koha/Schema/Result/AdditionalContentsLocalization.pm b/Koha/Schema/Result/AdditionalContentsLocalization.pm >new file mode 100644 >index 00000000000..773965ccbb9 >--- /dev/null >+++ b/Koha/Schema/Result/AdditionalContentsLocalization.pm >@@ -0,0 +1,148 @@ >+use utf8; >+package Koha::Schema::Result::AdditionalContentsLocalization; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::AdditionalContentsLocalization >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<additional_contents_localizations> >+ >+=cut >+ >+__PACKAGE__->table("additional_contents_localizations"); >+ >+=head1 ACCESSORS >+ >+=head2 id >+ >+ data_type: 'integer' >+ extra: {unsigned => 1} >+ is_auto_increment: 1 >+ is_nullable: 0 >+ >+unique identifier for the additional content >+ >+=head2 additional_content_id >+ >+ data_type: 'integer' >+ extra: {unsigned => 1} >+ is_foreign_key: 1 >+ is_nullable: 0 >+ >+link to the additional content >+ >+=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: 50 >+ >+lang >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "id", >+ { >+ data_type => "integer", >+ extra => { unsigned => 1 }, >+ is_auto_increment => 1, >+ is_nullable => 0, >+ }, >+ "additional_content_id", >+ { >+ data_type => "integer", >+ extra => { unsigned => 1 }, >+ is_foreign_key => 1, >+ is_nullable => 0, >+ }, >+ "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 }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</id> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("id"); >+ >+=head1 UNIQUE CONSTRAINTS >+ >+=head2 C<additional_contents_localizations_uniq> >+ >+=over 4 >+ >+=item * L</additional_content_id> >+ >+=item * L</lang> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->add_unique_constraint( >+ "additional_contents_localizations_uniq", >+ ["additional_content_id", "lang"], >+); >+ >+=head1 RELATIONS >+ >+=head2 additional_content >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::AdditionalContent> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "additional_content", >+ "Koha::Schema::Result::AdditionalContent", >+ { id => "additional_content_id" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-03-08 08:09:35 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KRaaWslsavWVmDbZF/NwcQ >+ >+ >+# You can replace this text with custom code or comments, and it will be preserved on regeneration >+1; >diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm >index c86ca6736f2..ee82d41eceb 100644 >--- a/Koha/Schema/Result/Branch.pm >+++ b/Koha/Schema/Result/Branch.pm >@@ -918,8 +918,8 @@ __PACKAGE__->has_many( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-11-08 17:35:26 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QPqXuEigMeIBb9NKMSkrNw >+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-03-03 07:23:06 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fGcjGoFNNgRbixuJTah55Q > > __PACKAGE__->add_columns( > '+pickup_location' => { is_boolean => 1 }, >-- >2.41.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31383
:
147891
|
147892
|
147893
|
147894
|
147895
|
147896
|
149813
|
149814
|
149815
|
149816
|
149817
|
149818
|
152423
|
152424
|
152425
|
152426
|
152427
|
152428
|
152545
|
152546
|
152547
|
152566
|
152660
|
152661
|
152662
|
152663
|
152664
|
152665
|
152666
|
152667
|
152668
|
152669
|
153013
|
153666
|
153667
|
153668
|
153669
|
153670
|
153671
|
153672
|
153673
|
153674
|
153675
|
153676
|
156048
|
156049
|
156050
|
156051
|
156052
|
156053
|
156054
|
156055
|
156056
|
156057
|
156058
|
156265
|
156266
|
156267
|
156268
|
156269
|
156270
|
156271
|
156272
|
156273
|
156274
|
156275
|
156276
|
157539
|
157540
|
157541
|
157542
|
157543
|
157544
|
157545
|
157546
|
157547
|
157548
|
157549
|
157550
|
157580
|
157585
|
157640
|
157741
|
157742