From 6417a1f2597932952eefc2e523ad35c09886de26 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 18 Oct 2022 09:50:41 -0300 Subject: [PATCH] Bug 31626: DBIC schema Signed-off-by: Tomas Cohen Arazi --- Koha/Schema/Result/Letter.pm | 19 +++++++++++++++-- Koha/Schema/Result/MessageQueue.pm | 34 ++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/Koha/Schema/Result/Letter.pm b/Koha/Schema/Result/Letter.pm index 613c4d9b27..7e01641a34 100644 --- a/Koha/Schema/Result/Letter.pm +++ b/Koha/Schema/Result/Letter.pm @@ -201,6 +201,21 @@ __PACKAGE__->add_unique_constraint( =head1 RELATIONS +=head2 message_queues + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "message_queues", + "Koha::Schema::Result::MessageQueue", + { "foreign.letter_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 message_transport_type Type: belongs_to @@ -217,8 +232,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2021-02-11 12:33:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qqdTVEicMu5rHppY5qsEuA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-10-18 12:50:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MA3WvXK/1ZBc407iU7ZcrA sub koha_object_class { 'Koha::Notice::Template'; diff --git a/Koha/Schema/Result/MessageQueue.pm b/Koha/Schema/Result/MessageQueue.pm index 810064a1b0..d2d36ce2a5 100644 --- a/Koha/Schema/Result/MessageQueue.pm +++ b/Koha/Schema/Result/MessageQueue.pm @@ -29,6 +29,14 @@ __PACKAGE__->table("message_queue"); is_auto_increment: 1 is_nullable: 0 +=head2 letter_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +Foreign key to the letters table + =head2 borrowernumber data_type: 'integer' @@ -113,6 +121,8 @@ __PACKAGE__->table("message_queue"); __PACKAGE__->add_columns( "message_id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "letter_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "borrowernumber", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "subject", @@ -191,6 +201,26 @@ __PACKAGE__->belongs_to( }, ); +=head2 letter + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "letter", + "Koha::Schema::Result::Letter", + { id => "letter_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 message_transport_type Type: belongs_to @@ -207,8 +237,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-05 08:57:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:NwbN8wPMAlucrw6iQ2XQ5g +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-10-18 12:50:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PX9JzZw0v134xuHqNbB0cA sub koha_object_class { 'Koha::Notice::Message'; -- 2.39.5