From 8cd0e108518c456154cc3906764d091f39c17ea9 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 25 Jun 2014 15:13:45 +0200 Subject: [PATCH] [PASSED QA] Bug 11023: DB changes Signed-off-by: Kyle M Hall --- Koha/Schema/Result/Deleteditem.pm | 13 +++++++++++-- Koha/Schema/Result/Item.pm | 13 +++++++++++-- installer/data/mysql/kohastructure.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 12 ++++++++++++ 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/Koha/Schema/Result/Deleteditem.pm b/Koha/Schema/Result/Deleteditem.pm index f915511..5d450c9 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.07039 @ 2014-10-24 09:58:16 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Ru5DyaIlWJcMNAgpZRjOLg +# Created by DBIx::Class::Schema::Loader v0.07041 @ 2014-11-05 09:42:42 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FuMIqaxfqRuclwG/pxrTtA # 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 8ea22e3..aa03796 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 @@ -609,8 +618,8 @@ __PACKAGE__->might_have( ); -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-10-24 09:58:16 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2slVK/FjcRDiYLeufoOFQQ +# Created by DBIx::Class::Schema::Loader v0.07041 @ 2014-11-05 09:42:42 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yCum/5krRX5Yv+qXQJ1QPg __PACKAGE__->belongs_to( "biblio", diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index a2f3e07..9f68322 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -946,6 +946,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`), @@ -1245,6 +1246,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 c380800..25b9466 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9628,6 +9628,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) -- 1.7.2.5