From e98bc9eb7d03d418b3ef7bfc9991e908279b2c46 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 16 Dec 2019 17:30:55 +0100 Subject: [PATCH] Bug 24161: DBIC changes Sponsored-by: Cork Institute of Technology --- Koha/Schema/Result/Aqorder.pm | 39 ++++++++------- Koha/Schema/Result/AqordersClaim.pm | 96 +++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 20 deletions(-) create mode 100644 Koha/Schema/Result/AqordersClaim.pm diff --git a/Koha/Schema/Result/Aqorder.pm b/Koha/Schema/Result/Aqorder.pm index 803511822d..e78eeb06af 100644 --- a/Koha/Schema/Result/Aqorder.pm +++ b/Koha/Schema/Result/Aqorder.pm @@ -143,7 +143,7 @@ __PACKAGE__->table("aqorders"); data_type: 'timestamp' datetime_undef_if_invalid: 1 - default_value: current_timestamp + default_value: 'current_timestamp()' is_nullable: 0 =head2 rrp @@ -271,18 +271,6 @@ __PACKAGE__->table("aqorders"); data_type: 'tinyint' is_nullable: 1 -=head2 claims_count - - data_type: 'integer' - default_value: 0 - is_nullable: 1 - -=head2 claimed_date - - data_type: 'date' - datetime_undef_if_invalid: 1 - is_nullable: 1 - =head2 subscriptionid data_type: 'integer' @@ -371,7 +359,7 @@ __PACKAGE__->add_columns( { data_type => "timestamp", datetime_undef_if_invalid => 1, - default_value => \"current_timestamp", + default_value => "current_timestamp()", is_nullable => 0, }, "rrp", @@ -416,10 +404,6 @@ __PACKAGE__->add_columns( { data_type => "varchar", is_nullable => 1, size => 10 }, "uncertainprice", { data_type => "tinyint", is_nullable => 1 }, - "claims_count", - { data_type => "integer", default_value => 0, is_nullable => 1 }, - "claimed_date", - { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, "subscriptionid", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "parent_ordernumber", @@ -470,6 +454,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 aqorders_claims + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "aqorders_claims", + "Koha::Schema::Result::AqordersClaim", + { "foreign.ordernumber" => "self.ordernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 aqorders_items Type: has_many @@ -661,8 +660,8 @@ Composing rels: L -> borrowernumber __PACKAGE__->many_to_many("borrowernumbers", "aqorder_users", "borrowernumber"); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-08-31 11:51:37 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GQEXetlivZm7buQohl8m4A +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-12-17 14:58:50 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:B/pTQKIu8guDBN3uLBkI6Q sub koha_objects_class { 'Koha::Acquisition::Orders'; diff --git a/Koha/Schema/Result/AqordersClaim.pm b/Koha/Schema/Result/AqordersClaim.pm new file mode 100644 index 0000000000..8ce00e11b1 --- /dev/null +++ b/Koha/Schema/Result/AqordersClaim.pm @@ -0,0 +1,96 @@ +use utf8; +package Koha::Schema::Result::AqordersClaim; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::AqordersClaim + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("aqorders_claims"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 ordernumber + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 claimed_on + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: 'current_timestamp()' + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "ordernumber", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "claimed_on", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => "current_timestamp()", + is_nullable => 0, + }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 ordernumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "ordernumber", + "Koha::Schema::Result::Aqorder", + { ordernumber => "ordernumber" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-12-16 16:29:06 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:m+0w++NPVQBiveXToQB8wQ + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.11.0