summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Schema.pm2
-rwxr-xr-xFS/bin/freeside-upgrade13
2 files changed, 13 insertions, 2 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index c786176ec..1885a650c 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -2467,9 +2467,7 @@ sub tables_hashref {
'vfieldpart', 'serial', '', '', '', '',
'dbtable', 'varchar', '', 32, '', '',
'name', 'varchar', '', 32, '', '',
- 'check_block', 'text', 'NULL', '', '', '',
'length', 'int', 'NULL', '', '', '',
- 'list_source', 'text', 'NULL', '', '', '',
'label', 'varchar', 'NULL', 80, '', '',
],
'primary_key' => 'vfieldpart',
diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade
index e11a0a7fe..16c30d9cf 100755
--- a/FS/bin/freeside-upgrade
+++ b/FS/bin/freeside-upgrade
@@ -127,6 +127,19 @@ my @statements = dbdef->sql_update_schema( dbdef_dist(datasrc),
{ 'nullify_default' => 1, },
);
+#### NEW CUSTOM FIELDS (prevent columns from being dropped by upgrade)
+my $cfsth = $dbh->prepare("SELECT * FROM part_virtual_field")
+ or die $dbh->errstr;
+$cfsth->execute or die $cfsth->errstr;
+my $cf;
+# likely a very inefficient implementation of this
+while ( $cf = $cfsth->fetchrow_hashref ) {
+ my $tbl = $cf->{'dbtable'};
+ my $name = $cf->{'name'};
+ @statements = grep { $_ !~ /^\s*ALTER\s+TABLE\s+$tbl\s+DROP\s+COLUMN\s+cf_$name\s*$/i }
+ @statements;
+}
+
@statements =
grep { $_ !~ /^CREATE +INDEX +h_queue/i } #useless, holds up queue insertion
@statements;