From 8c2440760f745d95e029df6a7678414e4607ef85 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sat, 30 Jul 2005 22:07:13 +0000 Subject: [PATCH] Starting with WebGUI 6.7.0 .sql files will no longer be used in core upgrades of WebGUI sites. We also suggest not using them for upgrades of custom code. The reason is that the database is becoming very complex, and it's easier to introduce errors to the database when modifying it directly rather than using the APIs. --- docs/migration.txt | 10 +++++++ docs/upgrades/upgrade_6.6.5-6.7.0.pl | 41 ++++++++++++++++++++++----- docs/upgrades/upgrade_6.6.5-6.7.0.sql | 8 ------ sbin/upgrade.pl | 26 +++++++++-------- 4 files changed, 58 insertions(+), 27 deletions(-) delete mode 100644 docs/upgrades/upgrade_6.6.5-6.7.0.sql diff --git a/docs/migration.txt b/docs/migration.txt index 1cf89f35a..46a5f3cd3 100644 --- a/docs/migration.txt +++ b/docs/migration.txt @@ -432,3 +432,13 @@ $f->text(name=>"this",id==>"myownpersonalid"); See WebGUI::HTMLForm and WebGUI::Form::Control for additional information. + +5.19 SQL Files For Upgrades Depricated + +Starting with WebGUI 6.7.0 .sql files will no longer be used in core upgrades +of WebGUI sites. We also suggest not using them for upgrades of custom code. +The reason is that the database is becoming very complex, and it's easier to +introduce errors to the database when modifying it directly rather than using +the APIs. + + diff --git a/docs/upgrades/upgrade_6.6.5-6.7.0.pl b/docs/upgrades/upgrade_6.6.5-6.7.0.pl index 25aa7afff..2295b38df 100644 --- a/docs/upgrades/upgrade_6.6.5-6.7.0.pl +++ b/docs/upgrades/upgrade_6.6.5-6.7.0.pl @@ -21,20 +21,47 @@ GetOptions( WebGUI::Session::open("../..",$configFile); +WebGUI::SQL->write("insert into webguiVersion values ('6.7.0','upgrade',unix_timestamp())"); + +giveSnippetsMimeTypes(); addAssetVersioning(); updateConfigFile(); insertHelpTemplate(); -insertXSLTSheets(); -insertSyndicatedContentTemplate(); -WebGUI::Group->new('9')->delete; -updateDefaultSurveyViewTemplate(); +makeSyndicatedContentChanges(); +removeOldThemeSystem(); +addSectionsToSurveys(); WebGUI::Session::close(); #------------------------------------------------- -sub updateDefaultSurveyViewTemplate { - print "\tUpdating Default Survey View template.\n" unless ($quiet); +sub giveSnippetsMimeTypes { + print "\tAllowing snippets to handle mime types.\n" unless ($quiet); + WebGUI::SQL->write("alter table snippet add column mimeType varchar(50) not null default 'text/html'"); +} + +#------------------------------------------------- +sub removeOldThemeSystem { + print "\tRemoving the old theme system.\n" unless ($quiet); + WebGUI::SQL->write("drop table theme"); + WebGUI::SQL->write("drop table themeComponent"); + WebGUI::Group->new('9')->delete; +} + +#------------------------------------------------- +sub makeSyndicatedContentChanges { + print "\tMaking changes to the syndicated content asset.\n" unless ($quiet); + WebGUI::SQL->write("alter table SyndicatedContent add column displayMode varchar(20) not null default 'interleaved'"); + WebGUI::SQL->write("alter table SyndicatedContent add column hasTerms varchar(255) not null"); + insertXSLTSheets(); + insertSyndicatedContentTemplate(); +} + +#------------------------------------------------- +sub addSectionsToSurveys { + print "\tAdding sections to Surveys.\n" unless ($quiet); + WebGUI::SQL->write("alter table Survey_question add column Survey_sectionId varchar(22) null"); + WebGUI::SQL->write("create table Survey_section (Survey_id varchar(22) null, Survey_sectionId varchar(22) not null, sectionName text null, sequenceNumber int(11) not null default 1, primary key (Survey_sectionId))"); my $template = q|

@@ -168,7 +195,7 @@ sub updateConfigFile { #------------------------------------------------- sub addAssetVersioning { print "\tMaking changes for asset versioning\n" unless ($quiet); - WebGUI::SQL->write("insert into settings ('autoCommit','1')"); + WebGUI::SQL->write("insert into settings values ('autoCommit','1')"); WebGUI::SQL->write("create table assetVersionTag ( tagId varchar(22) not null primary key, name varchar(255) not null, diff --git a/docs/upgrades/upgrade_6.6.5-6.7.0.sql b/docs/upgrades/upgrade_6.6.5-6.7.0.sql deleted file mode 100644 index c0ee2f756..000000000 --- a/docs/upgrades/upgrade_6.6.5-6.7.0.sql +++ /dev/null @@ -1,8 +0,0 @@ -insert into webguiVersion values ('6.7.0','upgrade',unix_timestamp()); -alter table SyndicatedContent add column displayMode varchar(20) not null default 'interleaved'; -alter table SyndicatedContent add column hasTerms varchar(255) not null; -alter table snippet add column mimeType varchar(50) not null default 'text/html'; -drop table theme; -drop table themeComponent; -alter table Survey_question add column Survey_sectionId varchar(22) null; -create table Survey_section (Survey_id varchar(22) null, Survey_sectionId varchar(22) not null, sectionName text null, sequenceNumber int(11) not null default 1, primary key (Survey_sectionId)); diff --git a/sbin/upgrade.pl b/sbin/upgrade.pl index 7e19055f4..567461589 100644 --- a/sbin/upgrade.pl +++ b/sbin/upgrade.pl @@ -227,7 +227,7 @@ foreach my $config (keys %config) { my $dumpcmd = $config{$config}{mysqlDump} || $mysqldump; my $backupTo = $config{$config}{backupPath} || $backupDir; mkdir($backupTo); - while ($upgrade{$config{$config}{version}}{sql} ne "") { + while ($upgrade{$config{$config}{version}}{sql} ne "" || $upgrade{$config{$config}{version}}{pl} ne "") { my $upgrade = $upgrade{$config{$config}{version}}{from}; unless ($skipBackup) { print "\n".$config{$config}{db}." ".$upgrade{$upgrade}{from}."-".$upgrade{$upgrade}{to}."\n" unless ($quiet); @@ -244,17 +244,19 @@ foreach my $config (keys %config) { fatalError(); } } - print "\tUpgrading to ".$upgrade{$upgrade}{to}."..." unless ($quiet); - my $cmd = $clicmd." -u".$config{$config}{dbuser}." -p".$config{$config}{dbpass}; - $cmd .= " --host=".$config{$config}{host} if ($config{$config}{host}); - $cmd .= " --port=".$config{$config}{port} if ($config{$config}{port}); - $cmd .= " --database=".$config{$config}{db}." < ".$upgrade{$upgrade}{sql}; - unless (system($cmd)) { - print "OK\n" unless ($quiet); - } else { - print "Failed!\n" unless ($quiet); - fatalError(); - } + if ($upgrade{$upgrade}{sql} ne "") { + print "\tUpgrading to ".$upgrade{$upgrade}{to}."..." unless ($quiet); + my $cmd = $clicmd." -u".$config{$config}{dbuser}." -p".$config{$config}{dbpass}; + $cmd .= " --host=".$config{$config}{host} if ($config{$config}{host}); + $cmd .= " --port=".$config{$config}{port} if ($config{$config}{port}); + $cmd .= " --database=".$config{$config}{db}." < ".$upgrade{$upgrade}{sql}; + unless (system($cmd)) { + print "OK\n" unless ($quiet); + } else { + print "Failed!\n" unless ($quiet); + fatalError(); + } + } if ($upgrade{$upgrade}{pl} ne "") { my $cmd = $perl." ".$upgrade{$upgrade}{pl}." --configFile=".$config; $cmd .= " --quiet" if ($quiet);