Bugzilla – Attachment 142003 Details for
Bug 24606
Allow storing item values as a template for creating new items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24606: Update database, add new schema file
Bug-24606-Update-database-add-new-schema-file.patch (text/plain), 5.46 KB, created by
David Nind
on 2022-10-17 18:55:42 UTC
(
hide
)
Description:
Bug 24606: Update database, add new schema file
Filename:
MIME Type:
Creator:
David Nind
Created:
2022-10-17 18:55:42 UTC
Size:
5.46 KB
patch
obsolete
>From 883e59b73425922bc3b5432c0f547d26d070163e Mon Sep 17 00:00:00 2001 >From: Kyle Hall <kyle@bywatersolutions.com> >Date: Thu, 29 Sep 2022 09:03:55 -0400 >Subject: [PATCH] Bug 24606: Update database, add new schema file > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/Schema/Result/ItemEditorTemplate.pm | 124 ++++++++++++++++++ > .../data/mysql/atomicupdate/bug_24606.pl | 24 ++++ > installer/data/mysql/kohastructure.sql | 15 +++ > 3 files changed, 163 insertions(+) > create mode 100644 Koha/Schema/Result/ItemEditorTemplate.pm > create mode 100755 installer/data/mysql/atomicupdate/bug_24606.pl > >diff --git a/Koha/Schema/Result/ItemEditorTemplate.pm b/Koha/Schema/Result/ItemEditorTemplate.pm >new file mode 100644 >index 0000000000..5ac366c172 >--- /dev/null >+++ b/Koha/Schema/Result/ItemEditorTemplate.pm >@@ -0,0 +1,124 @@ >+use utf8; >+package Koha::Schema::Result::ItemEditorTemplate; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::ItemEditorTemplate >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<item_editor_templates> >+ >+=cut >+ >+__PACKAGE__->table("item_editor_templates"); >+ >+=head1 ACCESSORS >+ >+=head2 id >+ >+ data_type: 'integer' >+ is_auto_increment: 1 >+ is_nullable: 0 >+ >+id for the template >+ >+=head2 borrowernumber >+ >+ data_type: 'integer' >+ is_foreign_key: 1 >+ is_nullable: 1 >+ >+creator of this template >+ >+=head2 name >+ >+ data_type: 'mediumtext' >+ is_nullable: 0 >+ >+template name >+ >+=head2 is_shared >+ >+ data_type: 'tinyint' >+ default_value: 0 >+ is_nullable: 0 >+ >+controls if template is shared >+ >+=head2 contents >+ >+ data_type: 'longtext' >+ is_nullable: 0 >+ >+json encoded template data >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "id", >+ { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, >+ "borrowernumber", >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, >+ "name", >+ { data_type => "mediumtext", is_nullable => 0 }, >+ "is_shared", >+ { data_type => "tinyint", default_value => 0, is_nullable => 0 }, >+ "contents", >+ { data_type => "longtext", is_nullable => 0 }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</id> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("id"); >+ >+=head1 RELATIONS >+ >+=head2 borrowernumber >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Borrower> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "borrowernumber", >+ "Koha::Schema::Result::Borrower", >+ { borrowernumber => "borrowernumber" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "SET NULL", >+ on_update => "CASCADE", >+ }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-09-28 16:49:35 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7JIe4z78F9oMOAnAZdqmtA >+ >+sub koha_object_class { >+ 'Koha::Item::Template'; >+} >+sub koha_objects_class { >+ 'Koha::Item::Templates'; >+} >+ >+1; >diff --git a/installer/data/mysql/atomicupdate/bug_24606.pl b/installer/data/mysql/atomicupdate/bug_24606.pl >new file mode 100755 >index 0000000000..76406122d9 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_24606.pl >@@ -0,0 +1,24 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "24606", >+ description => "Add new table item_editor_templates", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ >+ unless( TableExists( 'item_editor_templates' ) ) { >+ $dbh->do(q{ >+ CREATE TABLE `item_editor_templates` ( >+ `id` INT(11) NOT NULL auto_increment COMMENT "id for the template", >+ `borrowernumber` int(11) DEFAULT NULL COMMENT "creator of this template", >+ `name` MEDIUMTEXT NOT NULL COMMENT "template name", >+ `is_shared` TINYINT(1) NOT NULL DEFAULT 0 COMMENT "controls if template is shared", >+ `contents` LONGTEXT NOT NULL COMMENT "json encoded template data", >+ PRIMARY KEY (`id`), >+ CONSTRAINT `bn` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE >+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ }); >+ } >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 3d8a5efea2..24cd86617e 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1915,6 +1915,21 @@ CREATE TABLE `item_group_items` ( > CONSTRAINT `item_group_items_gifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > >+-- >+-- Table structure for table `item_editor_templates` >+-- >+ >+DROP TABLE IF EXISTS `item_editor_templates`; >+CREATE TABLE `item_editor_templates` ( >+ `id` INT(11) NOT NULL auto_increment COMMENT "id for the template", >+ `borrowernumber` int(11) DEFAULT NULL COMMENT "creator of this template", >+ `name` MEDIUMTEXT NOT NULL COMMENT "template name", >+ `is_shared` TINYINT(1) NOT NULL DEFAULT 0 COMMENT "controls if template is shared", >+ `contents` LONGTEXT NOT NULL COMMENT "json encoded template data", >+ PRIMARY KEY (`id`), >+ CONSTRAINT `bn` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE >+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ > -- > -- Table structure for table `club_holds` > -- >-- >2.30.2
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 24606
:
141613
|
141614
|
141615
|
141616
|
141617
|
141717
|
141718
|
141719
|
141720
|
141721
|
141972
|
142003
|
142004
|
142005
|
142006
|
142007
|
142008
|
142833
|
142834
|
142835
|
142836
|
142837
|
142877
|
142878
|
142879
|
142880
|
142881
|
142882
|
142883
|
142884
|
142885
|
142886
|
142887
|
142888
|
143020
|
143569
|
143570
|
143571
|
143572
|
143573
|
143574
|
143575
|
143576
|
143577
|
143578
|
143579
|
143580
|
143581
|
143794
|
143795
|
143796
|
143989
|
143990
|
144161