From 71a522056de87b6ecfd7116decd7562c83a5ff11 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 7 Jul 2014 13:16:08 +0200 Subject: [PATCH] [PASSED QA] Bug 10212: Columns configuration for tables - DB changes Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer --- Koha/Schema/Result/ColumnsSetting.pm | 103 +++++++++++++++++++++++++++++++++ installer/data/mysql/kohastructure.sql | 14 +++++ installer/data/mysql/updatedatabase.pl | 22 +++++++ 3 files changed, 139 insertions(+) create mode 100644 Koha/Schema/Result/ColumnsSetting.pm diff --git a/Koha/Schema/Result/ColumnsSetting.pm b/Koha/Schema/Result/ColumnsSetting.pm new file mode 100644 index 0000000..05d65fa --- /dev/null +++ b/Koha/Schema/Result/ColumnsSetting.pm @@ -0,0 +1,103 @@ +use utf8; +package Koha::Schema::Result::ColumnsSetting; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::ColumnsSetting + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("columns_settings"); + +=head1 ACCESSORS + +=head2 module + + data_type: 'varchar' + is_nullable: 0 + size: 255 + +=head2 page + + data_type: 'varchar' + is_nullable: 0 + size: 255 + +=head2 tablename + + data_type: 'varchar' + is_nullable: 0 + size: 255 + +=head2 columnname + + data_type: 'varchar' + is_nullable: 0 + size: 255 + +=head2 cannot_be_toggled + + data_type: 'integer' + default_value: 0 + is_nullable: 0 + +=head2 is_hidden + + data_type: 'integer' + default_value: 0 + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "module", + { data_type => "varchar", is_nullable => 0, size => 255 }, + "page", + { data_type => "varchar", is_nullable => 0, size => 255 }, + "tablename", + { data_type => "varchar", is_nullable => 0, size => 255 }, + "columnname", + { data_type => "varchar", is_nullable => 0, size => 255 }, + "cannot_be_toggled", + { data_type => "integer", default_value => 0, is_nullable => 0 }, + "is_hidden", + { data_type => "integer", default_value => 0, is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=item * L + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("module", "page", "tablename", "columnname"); + + +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-07-07 12:11:07 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:s4Zkf15c4v0RJyb1S5UTPA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index b46dc6a..ba2f157 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3422,6 +3422,20 @@ CREATE TABLE IF NOT EXISTS `misc_files` ( -- miscellaneous files attached to rec KEY `record_id` (`record_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- +-- Table structure for table `columns_settings` +-- + +CREATE TABLE IF NOT EXISTS columns_settings ( + module varchar(255) NOT NULL, + page varchar(255) NOT NULL, + tablename varchar(255) NOT NULL, + columnname varchar(255) NOT NULL, + cannot_be_toggled int(1) NOT NULL DEFAULT 0, + is_hidden int(1) NOT NULL DEFAULT 0, + PRIMARY KEY(module, page, tablename, columnname) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 1030454..f9bb67a 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8570,6 +8570,28 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } + + + + +$DBversion = "3.17.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q{ + CREATE TABLE IF NOT EXISTS columns_settings ( + module varchar(255) NOT NULL, + page varchar(255) NOT NULL, + tablename varchar(255) NOT NULL, + columnname varchar(255) NOT NULL, + cannot_be_toggled int(1) NOT NULL DEFAULT 0, + is_hidden int(1) NOT NULL DEFAULT 0, + PRIMARY KEY(module, page, tablename, columnname) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 + }); + print "Upgrade to $DBversion done (Bug 10212 - Create new table columns_settings)\n"; + SetVersion ($DBversion); +} + + =head1 FUNCTIONS =head2 TableExists($table) -- 1.9.1