From 97803d56c88dc4760140d912a76cb2730fcbf713 Mon Sep 17 00:00:00 2001 From: mark Date: Sat, 2 Oct 2010 20:54:27 +0000 Subject: [PATCH] mandatory custom field flag, RT#9260 --- FS/bin/freeside-upgrade | 15 +++++++++++++++ rt/FREESIDE_MODIFIED | 3 ++- rt/etc/schema.mysql-4.1 | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade index d3723a188..aca545b84 100755 --- a/FS/bin/freeside-upgrade +++ b/FS/bin/freeside-upgrade @@ -71,6 +71,21 @@ if ( dbdef->table('cgp_rule_condition') && } +# RT required field flag +# for consistency with RT schema: mysql is in CamelCase, +# pg is in lowercase, and they use different data types. +my ($t, $creq, $cdis) = + map { driver_name =~ /^mysql/i ? $_ : lc($_) } + ('CustomFields','Required','Disabled'); + +if ( dbdef->table($t) && + ! dbdef->table($t)->column($creq) ) { + push @bugfix, + "ALTER TABLE $t ADD COLUMN $creq ". + dbdef->table($t)->column($cdis)->type . + ' NOT NULL DEFAULT 0'; +} + if ( $DRY_RUN ) { print join(";\n", @bugfix ). ";\n"; diff --git a/rt/FREESIDE_MODIFIED b/rt/FREESIDE_MODIFIED index d73a5e055..45a61062e 100644 --- a/rt/FREESIDE_MODIFIED +++ b/rt/FREESIDE_MODIFIED @@ -5,9 +5,10 @@ config.layout.in etc/RT_Config.pm etc/RT_SiteConfig.pm etc/schema.Pg + etc/schema.mysql-4.1 lib/RT/Config.pm -lib/RT?CustomField.pm #CheckMandatoryFields +lib/RT/CustomField.pm #CheckMandatoryFields lib/RT/CustomField_Overlay.pm #customfield date patch lib/RT/Interface/Web.pm #customfield date patch lib/RT/Interface/Web_Vendor.pm diff --git a/rt/etc/schema.mysql-4.1 b/rt/etc/schema.mysql-4.1 index 172e477c1..173570219 100755 --- a/rt/etc/schema.mysql-4.1 +++ b/rt/etc/schema.mysql-4.1 @@ -386,6 +386,7 @@ CREATE TABLE CustomFields ( LastUpdatedBy integer NOT NULL DEFAULT 0 , LastUpdated DATETIME NULL , Disabled int2 NOT NULL DEFAULT 0 , + Required int2 NOT NULL DEFAULT 0 , PRIMARY KEY (id) ) TYPE=InnoDB CHARACTER SET utf8; -- 2.11.0