From 078a6971fbbabd25c8ac6f2b5fb991d3837ec5ca Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 19 Feb 2018 10:25:21 -0300 Subject: [PATCH] Bug 18336: (follow-up) Shift TINYTEXT columns This patch fixes two errors that slipped in the patchset. To test: - Create a dummy branch for testing: $ cd kohaclone $ git fetch $ git checkout v17.11.00 -b dummy - Reset your working DB $ reset_all (y) - Set your branch to current master $ git reset --hard origin/master - Update the DB $ updatedatabase - Update the schema files $ kshell k$ misc/devel/update_dbix_class_files.pl \ --db_name koha_kohadev \ --db_user koha_kohadev \ --db_passwd password k$ exit $ git diff => FAIL: There are discrepancies on upgrades - Reset to v17.11.00 revision and DB: $ git reset --hard v17.11.00 $ reset_all (y) - Set your branch to current master $ git reset --hard origin/master - Apply this patch - Update the DB $ updatedatabase - Update the schema files $ kshell k$ misc/devel/update_dbix_class_files.pl \ --db_name koha_kohadev \ --db_user koha_kohadev \ --db_passwd password k$ exit $ git diff => SUCCESS: No discrepancies! - Reset to HEAD to get rid of the schema changes $ git reset --hard HEAD - Regenerate the schema files on top of this patch $ dbic ; cd /home/vagrant/kohaclone $ git diff => SUCCESS: No discrepancies! - Sign off :-D Signed-off-by: Tomas Cohen Arazi --- Koha/Schema/Result/MarcSubfieldStructure.pm | 12 ++++++------ installer/data/mysql/kohastructure.sql | 10 +++++----- installer/data/mysql/updatedatabase.pl | 6 ++++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Koha/Schema/Result/MarcSubfieldStructure.pm b/Koha/Schema/Result/MarcSubfieldStructure.pm index ac4fec5a84..1c28713b02 100644 --- a/Koha/Schema/Result/MarcSubfieldStructure.pm +++ b/Koha/Schema/Result/MarcSubfieldStructure.pm @@ -79,7 +79,7 @@ __PACKAGE__->table("marc_subfield_structure"); data_type: 'varchar' is_foreign_key: 1 is_nullable: 1 - size: 20 + size: 32 =head2 authtypecode @@ -124,7 +124,7 @@ __PACKAGE__->table("marc_subfield_structure"); =head2 defaultvalue - data_type: 'text' + data_type: 'mediumtext' is_nullable: 1 =head2 maxlength @@ -153,7 +153,7 @@ __PACKAGE__->add_columns( "tab", { data_type => "tinyint", is_nullable => 1 }, "authorised_value", - { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 20 }, + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 32 }, "authtypecode", { data_type => "varchar", is_nullable => 1, size => 20 }, "value_builder", @@ -169,7 +169,7 @@ __PACKAGE__->add_columns( "link", { data_type => "varchar", is_nullable => 1, size => 80 }, "defaultvalue", - { data_type => "text", is_nullable => 1 }, + { data_type => "mediumtext", is_nullable => 1 }, "maxlength", { data_type => "integer", default_value => 9999, is_nullable => 0 }, ); @@ -213,8 +213,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:V++tjMyI92SwFjikQAAJFg +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-02 18:57:57 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:18iBiNNiwTSYtKk28aoLJg # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 0880df0e1b..8151a2901c 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3444,7 +3444,7 @@ CREATE TABLE uploaded_files ( dir MEDIUMTEXT NOT NULL, filesize int(11), dtcreated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - uploadcategorycode tinytext, + uploadcategorycode TEXT, owner int(11), public tinyint, permanent tinyint, @@ -3967,7 +3967,7 @@ CREATE TABLE deletedbiblio_metadata ( CREATE TABLE IF NOT EXISTS club_templates ( id int(11) NOT NULL AUTO_INCREMENT, - `name` tinytext NOT NULL, + `name` TEXT NOT NULL, description MEDIUMTEXT, is_enrollable_from_opac tinyint(1) NOT NULL DEFAULT '0', is_email_required tinyint(1) NOT NULL DEFAULT '0', @@ -3987,7 +3987,7 @@ CREATE TABLE IF NOT EXISTS club_templates ( CREATE TABLE IF NOT EXISTS clubs ( id int(11) NOT NULL AUTO_INCREMENT, club_template_id int(11) NOT NULL, - `name` tinytext NOT NULL, + `name` TEXT NOT NULL, description MEDIUMTEXT, date_start date DEFAULT NULL, date_end date DEFAULT NULL, @@ -4030,7 +4030,7 @@ CREATE TABLE IF NOT EXISTS club_enrollments ( CREATE TABLE IF NOT EXISTS club_template_enrollment_fields ( id int(11) NOT NULL AUTO_INCREMENT, club_template_id int(11) NOT NULL, - `name` tinytext NOT NULL, + `name` TEXT NOT NULL, description MEDIUMTEXT, authorised_value_category varchar(16) DEFAULT NULL, PRIMARY KEY (id), @@ -4061,7 +4061,7 @@ CREATE TABLE IF NOT EXISTS club_enrollment_fields ( CREATE TABLE IF NOT EXISTS club_template_fields ( id int(11) NOT NULL AUTO_INCREMENT, club_template_id int(11) NOT NULL, - `name` tinytext NOT NULL, + `name` TEXT NOT NULL, description MEDIUMTEXT, authorised_value_category varchar(16) DEFAULT NULL, PRIMARY KEY (id), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index b5a84edda6..1001302410 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -15468,7 +15468,7 @@ if( CheckVersion( $DBversion ) ) { MODIFY COLUMN kohafield VARCHAR(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL, MODIFY COLUMN authorised_value - VARCHAR(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + VARCHAR(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, MODIFY COLUMN authtypecode VARCHAR(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, MODIFY COLUMN value_builder @@ -15478,7 +15478,9 @@ if( CheckVersion( $DBversion ) ) { MODIFY COLUMN seealso VARCHAR(1100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, MODIFY COLUMN link - VARCHAR(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL + VARCHAR(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + MODIFY COLUMN defaultvalue + MEDIUMTEXT COLLATE utf8mb4_unicode_ci default NULL |); $dbh->do(qq|ALTER TABLE $name CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci|); } -- 2.16.2