Bug 30708: DBIC schema changes

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: BULAC - http://www.bulac.fr/
Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov>
Signed-off-by: Laurence Rault <laurence.rault@biblibre.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2023-04-17 20:48:16 +02:00 committed by Tomas Cohen Arazi
parent 4aff88aa13
commit c984f42c94
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
6 changed files with 773 additions and 2 deletions

View file

@ -852,6 +852,21 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 }, { cascade_copy => 0, cascade_delete => 0 },
); );
=head2 preservation_trains_items
Type: has_many
Related object: L<Koha::Schema::Result::PreservationTrainsItem>
=cut
__PACKAGE__->has_many(
"preservation_trains_items",
"Koha::Schema::Result::PreservationTrainsItem",
{ "foreign.item_id" => "self.itemnumber" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 recalls =head2 recalls
Type: has_many Type: has_many
@ -943,8 +958,8 @@ __PACKAGE__->might_have(
); );
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-07-26 17:44:52 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-07-31 11:33:55
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FHB+BvL4it4HrzlfNCxoKw # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:w/riz2YWgVUds0eMqZuGTg
__PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" ); __PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" );

View file

@ -0,0 +1,116 @@
use utf8;
package Koha::Schema::Result::PreservationProcessing;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::PreservationProcessing
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<preservation_processings>
=cut
__PACKAGE__->table("preservation_processings");
=head1 ACCESSORS
=head2 processing_id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
primary key
=head2 name
data_type: 'varchar'
is_nullable: 0
size: 80
name of the processing
=cut
__PACKAGE__->add_columns(
"processing_id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"name",
{ data_type => "varchar", is_nullable => 0, size => 80 },
);
=head1 PRIMARY KEY
=over 4
=item * L</processing_id>
=back
=cut
__PACKAGE__->set_primary_key("processing_id");
=head1 RELATIONS
=head2 preservation_processing_attributes
Type: has_many
Related object: L<Koha::Schema::Result::PreservationProcessingAttribute>
=cut
__PACKAGE__->has_many(
"preservation_processing_attributes",
"Koha::Schema::Result::PreservationProcessingAttribute",
{ "foreign.processing_id" => "self.processing_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 preservation_trains
Type: has_many
Related object: L<Koha::Schema::Result::PreservationTrain>
=cut
__PACKAGE__->has_many(
"preservation_trains",
"Koha::Schema::Result::PreservationTrain",
{ "foreign.default_processing_id" => "self.processing_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 preservation_trains_items
Type: has_many
Related object: L<Koha::Schema::Result::PreservationTrainsItem>
=cut
__PACKAGE__->has_many(
"preservation_trains_items",
"Koha::Schema::Result::PreservationTrainsItem",
{ "foreign.processing_id" => "self.processing_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-17 18:47:47
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:m7bHppTX3UpQY9CfmRPqQA
# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;

View file

@ -0,0 +1,137 @@
use utf8;
package Koha::Schema::Result::PreservationProcessingAttribute;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::PreservationProcessingAttribute
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<preservation_processing_attributes>
=cut
__PACKAGE__->table("preservation_processing_attributes");
=head1 ACCESSORS
=head2 processing_attribute_id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
primary key
=head2 processing_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 0
link to the processing
=head2 name
data_type: 'varchar'
is_nullable: 0
size: 80
name of the processing attribute
=head2 type
data_type: 'enum'
extra: {list => ["authorised_value","free_text","db_column"]}
is_nullable: 0
Type of the processing attribute
=head2 option_source
data_type: 'varchar'
is_nullable: 1
size: 80
source of the possible options for this attribute
=cut
__PACKAGE__->add_columns(
"processing_attribute_id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"processing_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"name",
{ data_type => "varchar", is_nullable => 0, size => 80 },
"type",
{
data_type => "enum",
extra => { list => ["authorised_value", "free_text", "db_column"] },
is_nullable => 0,
},
"option_source",
{ data_type => "varchar", is_nullable => 1, size => 80 },
);
=head1 PRIMARY KEY
=over 4
=item * L</processing_attribute_id>
=back
=cut
__PACKAGE__->set_primary_key("processing_attribute_id");
=head1 RELATIONS
=head2 preservation_processing_attributes_items
Type: has_many
Related object: L<Koha::Schema::Result::PreservationProcessingAttributesItem>
=cut
__PACKAGE__->has_many(
"preservation_processing_attributes_items",
"Koha::Schema::Result::PreservationProcessingAttributesItem",
{
"foreign.processing_attribute_id" => "self.processing_attribute_id",
},
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 processing
Type: belongs_to
Related object: L<Koha::Schema::Result::PreservationProcessing>
=cut
__PACKAGE__->belongs_to(
"processing",
"Koha::Schema::Result::PreservationProcessing",
{ processing_id => "processing_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-17 18:47:47
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:i0vFmFYaqiZFyXGxDp+6oQ
# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;

View file

@ -0,0 +1,113 @@
use utf8;
package Koha::Schema::Result::PreservationProcessingAttributesItem;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::PreservationProcessingAttributesItem
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<preservation_processing_attributes_items>
=cut
__PACKAGE__->table("preservation_processing_attributes_items");
=head1 ACCESSORS
=head2 processing_attribute_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 0
link with preservation_processing_attributes
=head2 train_item_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 0
link with preservation_trains_items
=head2 value
data_type: 'varchar'
is_nullable: 1
size: 255
value for this attribute
=cut
__PACKAGE__->add_columns(
"processing_attribute_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"train_item_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"value",
{ data_type => "varchar", is_nullable => 1, size => 255 },
);
=head1 PRIMARY KEY
=over 4
=item * L</processing_attribute_id>
=item * L</train_item_id>
=back
=cut
__PACKAGE__->set_primary_key("processing_attribute_id", "train_item_id");
=head1 RELATIONS
=head2 processing_attribute
Type: belongs_to
Related object: L<Koha::Schema::Result::PreservationProcessingAttribute>
=cut
__PACKAGE__->belongs_to(
"processing_attribute",
"Koha::Schema::Result::PreservationProcessingAttribute",
{ processing_attribute_id => "processing_attribute_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
=head2 train_item
Type: belongs_to
Related object: L<Koha::Schema::Result::PreservationTrainsItem>
=cut
__PACKAGE__->belongs_to(
"train_item",
"Koha::Schema::Result::PreservationTrainsItem",
{ train_item_id => "train_item_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-17 18:47:47
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CiFAelBwfhQzRX1cL0ssqA
# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;

View file

@ -0,0 +1,195 @@
use utf8;
package Koha::Schema::Result::PreservationTrain;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::PreservationTrain
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<preservation_trains>
=cut
__PACKAGE__->table("preservation_trains");
=head1 ACCESSORS
=head2 train_id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
primary key
=head2 name
data_type: 'varchar'
is_nullable: 0
size: 80
name of the train
=head2 description
data_type: 'varchar'
is_nullable: 1
size: 255
description of the train
=head2 default_processing_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 1
default processing, link to preservation_processings.processing_id
=head2 not_for_loan
data_type: 'varchar'
default_value: 0
is_nullable: 0
size: 80
NOT_LOAN authorised value to apply toitem added to this train
=head2 created_on
data_type: 'timestamp'
datetime_undef_if_invalid: 1
default_value: current_timestamp
is_nullable: 0
creation date
=head2 closed_on
data_type: 'datetime'
datetime_undef_if_invalid: 1
is_nullable: 1
closing date
=head2 sent_on
data_type: 'datetime'
datetime_undef_if_invalid: 1
is_nullable: 1
sending date
=head2 received_on
data_type: 'datetime'
datetime_undef_if_invalid: 1
is_nullable: 1
receiving date
=cut
__PACKAGE__->add_columns(
"train_id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"name",
{ data_type => "varchar", is_nullable => 0, size => 80 },
"description",
{ data_type => "varchar", is_nullable => 1, size => 255 },
"default_processing_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"not_for_loan",
{ data_type => "varchar", default_value => 0, is_nullable => 0, size => 80 },
"created_on",
{
data_type => "timestamp",
datetime_undef_if_invalid => 1,
default_value => \"current_timestamp",
is_nullable => 0,
},
"closed_on",
{
data_type => "datetime",
datetime_undef_if_invalid => 1,
is_nullable => 1,
},
"sent_on",
{
data_type => "datetime",
datetime_undef_if_invalid => 1,
is_nullable => 1,
},
"received_on",
{
data_type => "datetime",
datetime_undef_if_invalid => 1,
is_nullable => 1,
},
);
=head1 PRIMARY KEY
=over 4
=item * L</train_id>
=back
=cut
__PACKAGE__->set_primary_key("train_id");
=head1 RELATIONS
=head2 default_processing
Type: belongs_to
Related object: L<Koha::Schema::Result::PreservationProcessing>
=cut
__PACKAGE__->belongs_to(
"default_processing",
"Koha::Schema::Result::PreservationProcessing",
{ processing_id => "default_processing_id" },
{
is_deferrable => 1,
join_type => "LEFT",
on_delete => "SET NULL",
on_update => "CASCADE",
},
);
=head2 preservation_trains_items
Type: has_many
Related object: L<Koha::Schema::Result::PreservationTrainsItem>
=cut
__PACKAGE__->has_many(
"preservation_trains_items",
"Koha::Schema::Result::PreservationTrainsItem",
{ "foreign.train_id" => "self.train_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-17 18:47:47
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ojxQ0wFj2datCPVjeuTBWw
# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;

View file

@ -0,0 +1,195 @@
use utf8;
package Koha::Schema::Result::PreservationTrainsItem;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::PreservationTrainsItem
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<preservation_trains_items>
=cut
__PACKAGE__->table("preservation_trains_items");
=head1 ACCESSORS
=head2 train_item_id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
primary key
=head2 train_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 0
link with preservation_train
=head2 item_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 0
link with items
=head2 processing_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 1
specific processing for this item
=head2 user_train_item_id
data_type: 'integer'
is_nullable: 0
train item id for this train, starts from 1
=head2 added_on
data_type: 'datetime'
datetime_undef_if_invalid: 1
is_nullable: 1
added date
=cut
__PACKAGE__->add_columns(
"train_item_id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"train_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"item_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"processing_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"user_train_item_id",
{ data_type => "integer", is_nullable => 0 },
"added_on",
{
data_type => "datetime",
datetime_undef_if_invalid => 1,
is_nullable => 1,
},
);
=head1 PRIMARY KEY
=over 4
=item * L</train_item_id>
=back
=cut
__PACKAGE__->set_primary_key("train_item_id");
=head1 UNIQUE CONSTRAINTS
=head2 C<train_id>
=over 4
=item * L</train_id>
=item * L</item_id>
=back
=cut
__PACKAGE__->add_unique_constraint("train_id", ["train_id", "item_id"]);
=head1 RELATIONS
=head2 item
Type: belongs_to
Related object: L<Koha::Schema::Result::Item>
=cut
__PACKAGE__->belongs_to(
"item",
"Koha::Schema::Result::Item",
{ itemnumber => "item_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
=head2 preservation_processing_attributes_items
Type: has_many
Related object: L<Koha::Schema::Result::PreservationProcessingAttributesItem>
=cut
__PACKAGE__->has_many(
"preservation_processing_attributes_items",
"Koha::Schema::Result::PreservationProcessingAttributesItem",
{ "foreign.train_item_id" => "self.train_item_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 processing
Type: belongs_to
Related object: L<Koha::Schema::Result::PreservationProcessing>
=cut
__PACKAGE__->belongs_to(
"processing",
"Koha::Schema::Result::PreservationProcessing",
{ processing_id => "processing_id" },
{
is_deferrable => 1,
join_type => "LEFT",
on_delete => "SET NULL",
on_update => "CASCADE",
},
);
=head2 train
Type: belongs_to
Related object: L<Koha::Schema::Result::PreservationTrain>
=cut
__PACKAGE__->belongs_to(
"train",
"Koha::Schema::Result::PreservationTrain",
{ train_id => "train_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-17 18:47:47
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:lpvjaV+qXrIDVlimBaycgA
# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;