From 0be1fab5c9b70d9693d023df599f22d6124ac64c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 25 Jun 2014 15:13:45 +0200 Subject: [PATCH] Bug 11023: DB changes --- Koha/Schema/Result/Deleteditem.pm | 13 +++++++++++-- Koha/Schema/Result/Item.pm | 17 +++++++++++++---- installer/data/mysql/kohastructure.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 12 ++++++++++++ 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/Koha/Schema/Result/Deleteditem.pm b/Koha/Schema/Result/Deleteditem.pm index 152d397..bac6db5 100644 --- a/Koha/Schema/Result/Deleteditem.pm +++ b/Koha/Schema/Result/Deleteditem.pm @@ -265,6 +265,13 @@ __PACKAGE__->table("deleteditems"); is_nullable: 1 size: 32 +=head2 new + + accessor: undef + data_type: 'varchar' + is_nullable: 1 + size: 32 + =cut __PACKAGE__->add_columns( @@ -365,6 +372,8 @@ __PACKAGE__->add_columns( { data_type => "varchar", is_nullable => 1, size => 32 }, "stocknumber", { data_type => "varchar", is_nullable => 1, size => 32 }, + "new", + { accessor => undef, data_type => "varchar", is_nullable => 1, size => 32 }, ); =head1 PRIMARY KEY @@ -380,8 +389,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("itemnumber"); -# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-12-23 16:39:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Ji1W0q5g5xTw1J89cjVlWw +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-06-25 15:02:46 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+qhg5GixwXyxf99J5CUI4w # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm index fd50d15..e89b22d 100644 --- a/Koha/Schema/Result/Item.pm +++ b/Koha/Schema/Result/Item.pm @@ -268,6 +268,13 @@ __PACKAGE__->table("items"); is_nullable: 1 size: 32 +=head2 new + + accessor: undef + data_type: 'varchar' + is_nullable: 1 + size: 32 + =cut __PACKAGE__->add_columns( @@ -373,6 +380,8 @@ __PACKAGE__->add_columns( { data_type => "varchar", is_nullable => 1, size => 32 }, "stocknumber", { data_type => "varchar", is_nullable => 1, size => 32 }, + "new", + { accessor => undef, data_type => "varchar", is_nullable => 1, size => 32 }, ); =head1 PRIMARY KEY @@ -508,7 +517,7 @@ __PACKAGE__->belongs_to( { is_deferrable => 1, join_type => "LEFT", - on_delete => "CASCADE", + on_delete => "RESTRICT", on_update => "CASCADE", }, ); @@ -528,7 +537,7 @@ __PACKAGE__->belongs_to( { is_deferrable => 1, join_type => "LEFT", - on_delete => "CASCADE", + on_delete => "RESTRICT", on_update => "CASCADE", }, ); @@ -609,8 +618,8 @@ __PACKAGE__->might_have( ); -# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-12-19 06:29:02 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:h6fPG62SifJ5T8QKPZNBBw +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-06-25 15:02:46 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:65YUTXGvZEgL1A/sI4dh1Q __PACKAGE__->belongs_to( "biblio", diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index b46dc6a..84f6a57 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -920,6 +920,7 @@ CREATE TABLE `deleteditems` ( `enumchron` text default NULL, -- serial enumeration/chronology for the item (MARC21 952$h) `copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t) `stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i) + `new` VARCHAR(32) DEFAULT NULL, -- 'new' value, you can put whatever free-text information. This field is intented to be managed by the toggle_new_status cronjob. PRIMARY KEY (`itemnumber`), KEY `delitembarcodeidx` (`barcode`), KEY `delitemstocknumberidx` (`stocknumber`), @@ -1216,6 +1217,7 @@ CREATE TABLE `items` ( -- holdings/item information `enumchron` text default NULL, -- serial enumeration/chronology for the item (MARC21 952$h) `copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t) `stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i) + `new` VARCHAR(32) DEFAULT NULL, -- 'new' value, you can put whatever free-text information. This field is intended to be managed by the toggle_new_status cronjob. PRIMARY KEY (`itemnumber`), UNIQUE KEY `itembarcodeidx` (`barcode`), KEY `itemstocknumberidx` (`stocknumber`), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index c68ba51..4310214 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8560,6 +8560,18 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.17.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do(q{ + ALTER TABLE `items` ADD `new` VARCHAR(32) NULL AFTER `stocknumber`; + }); + $dbh->do(q{ + ALTER TABLE `deleteditems` ADD `new` VARCHAR(32) NULL AFTER `stocknumber`; + }); + print "Upgrade to $DBversion done (Bug 11023: Adds field 'new' in items and deleteditems tables)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) -- 2.0.0.rc2