From 769a7c1a4fedb4663fdb85222ae0dbe56196c30f Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 25 Oct 2022 13:04:33 +0100 Subject: [PATCH] Bug 31028: New DBIC Schema files Signed-off-by: David Nind Signed-off-by: Helen Oliver Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- Koha/Schema/Result/Ticket.pm | 215 +++++++++++++++++++++++++++++ Koha/Schema/Result/TicketUpdate.pm | 152 ++++++++++++++++++++ 2 files changed, 367 insertions(+) create mode 100644 Koha/Schema/Result/Ticket.pm create mode 100644 Koha/Schema/Result/TicketUpdate.pm diff --git a/Koha/Schema/Result/Ticket.pm b/Koha/Schema/Result/Ticket.pm new file mode 100644 index 0000000000..d45e542d44 --- /dev/null +++ b/Koha/Schema/Result/Ticket.pm @@ -0,0 +1,215 @@ +use utf8; +package Koha::Schema::Result::Ticket; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::Ticket + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("tickets"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +primary key + +=head2 reporter_id + + data_type: 'integer' + default_value: 0 + is_foreign_key: 1 + is_nullable: 0 + +id of the patron who reported the ticket + +=head2 reported_date + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 0 + +date and time this ticket was reported + +=head2 title + + data_type: 'text' + is_nullable: 0 + +ticket title + +=head2 body + + data_type: 'text' + is_nullable: 0 + +ticket details + +=head2 resolver_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +id of the user who resolved the ticket + +=head2 resolved_date + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +date and time this ticket was resolved + +=head2 biblio_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +id of biblio linked + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "reporter_id", + { + data_type => "integer", + default_value => 0, + is_foreign_key => 1, + is_nullable => 0, + }, + "reported_date", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => \"current_timestamp", + is_nullable => 0, + }, + "title", + { data_type => "text", is_nullable => 0 }, + "body", + { data_type => "text", is_nullable => 0 }, + "resolver_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "resolved_date", + { + data_type => "datetime", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, + "biblio_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 biblio + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "biblio", + "Koha::Schema::Result::Biblio", + { biblionumber => "biblio_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + +=head2 reporter + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "reporter", + "Koha::Schema::Result::Borrower", + { borrowernumber => "reporter_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 resolver + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "resolver", + "Koha::Schema::Result::Borrower", + { borrowernumber => "resolver_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + +=head2 ticket_updates + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "ticket_updates", + "Koha::Schema::Result::TicketUpdate", + { "foreign.ticket_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-10-24 21:15:34 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0Nm+y1BHJicrpeq3kuU1VA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/TicketUpdate.pm b/Koha/Schema/Result/TicketUpdate.pm new file mode 100644 index 0000000000..edbc984ee4 --- /dev/null +++ b/Koha/Schema/Result/TicketUpdate.pm @@ -0,0 +1,152 @@ +use utf8; +package Koha::Schema::Result::TicketUpdate; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::TicketUpdate + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("ticket_updates"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +primary key + +=head2 ticket_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +id of catalog ticket the update relates to + +=head2 user_id + + data_type: 'integer' + default_value: 0 + is_foreign_key: 1 + is_nullable: 0 + +id of the user who logged the update + +=head2 public + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +boolean flag to denote whether this update is public + +=head2 date + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 0 + +date and time this update was logged + +=head2 message + + data_type: 'text' + is_nullable: 0 + +update message content + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "ticket_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "user_id", + { + data_type => "integer", + default_value => 0, + is_foreign_key => 1, + is_nullable => 0, + }, + "public", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, + "date", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => \"current_timestamp", + is_nullable => 0, + }, + "message", + { data_type => "text", is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 ticket + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "ticket", + "Koha::Schema::Result::Ticket", + { id => "ticket_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 user + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "user", + "Koha::Schema::Result::Borrower", + { borrowernumber => "user_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-10-24 18:31:28 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8YG3jhlqbHWptc28pvBmrg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.39.5