mandatory custom field flag, RT#9260
authormark <mark>
Sat, 2 Oct 2010 20:54:27 +0000 (20:54 +0000)
committermark <mark>
Sat, 2 Oct 2010 20:54:27 +0000 (20:54 +0000)
FS/bin/freeside-upgrade
rt/FREESIDE_MODIFIED
rt/etc/schema.mysql-4.1

index d3723a1..aca545b 100755 (executable)
@@ -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";
index d73a5e0..45a6106 100644 (file)
@@ -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
index 172e477..1735702 100755 (executable)
@@ -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;