handle "release" as a reserved word in update_mysql
authorTony Cook <tony@develop-help.com>
Tue, 18 Dec 2007 05:05:06 +0000 (05:05 +0000)
committertony <tony@45cb6cf1-00bc-42d2-bb5a-07f51df49f94>
Tue, 18 Dec 2007 05:05:06 +0000 (05:05 +0000)
schema/bse.sql
site/util/mysql.str
site/util/upgrade_mysql.pl

index fc9b51b9f16da7b00a87a8bf098acc4d89490b2a..6a774ccc174a8452815c5c88350c1aea4dbeff4d 100644 (file)
@@ -21,7 +21,7 @@ CREATE TABLE article (
 
   -- position of first image for this article
   imagePos char(2) not null,
-  `release` datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+  `release` datetime DEFAULT '1990-01-01 00:00:00' NOT NULL,
   expire datetime DEFAULT '2999-12-31 23:59:59' NOT NULL,
   keyword varchar(255) not null default '',
 
index 60bc2dfa5d03e22d3eff6e0a814e777847b5e22c..662d99c00856c47945bc434c84edc1e9c5c5acec 100644 (file)
@@ -38,7 +38,7 @@ Column thumbImage;varchar(64);NO;;
 Column thumbWidth;int(11);NO;;
 Column thumbHeight;int(11);NO;;
 Column imagePos;char(2);NO;;
-Column release;datetime;NO;0000-00-00 00:00:00;
+Column release;datetime;NO;1990-01-01 00:00:00;
 Column expire;datetime;NO;2999-12-31 23:59:59;
 Column keyword;varchar(255);NO;;
 Column template;varchar(127);NO;;
index 838316e4d0c33f932708befb4a17ebf66a0c650c..f75ac8c9f1fba0d57b55f24b4a723e2e26edd4ba 100644 (file)
@@ -163,7 +163,7 @@ for my $table (sort keys %tables) {
     my $sql = "alter table $table add ";
     $sql .= $index->{unique} ? "unique " : "index ";
     $sql .= $name . " ";
-    $sql .= "(" . join(",", @{$index->{cols}}) . ")";
+    $sql .= "(" . join(",", map("`$_`", @{$index->{cols}})) . ")";
 
     run_sql($sql)
       or die "Cannot add index $name: $DBI::errstr\n";
@@ -217,7 +217,7 @@ sub create_clauses {
 
   my @results;
   for my $col (@cols) {
-    my $sql = $col->{field} . " " . $col->{type};
+    my $sql = "`" . $col->{field} . "` " . $col->{type};
     $sql .= $col->{null} eq 'YES' ? ' null' : ' not null';
     if ($col->{default} ne 'NULL' &&
        ($col->{type} =~ /char/i || $col->{default} =~ /\d/)) {