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.
This commit is contained in:
parent
876b1da8bb
commit
8c2440760f
4 changed files with 58 additions and 27 deletions
|
|
@ -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.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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|<a name="<tmpl_var assetId>"></a>
|
||||
<tmpl_if session.var.adminOn>
|
||||
<p><tmpl_var controls></p>
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue