From fedca43854cc585942d7549b4a0b8d88f60a49a5 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sun, 6 Apr 2008 23:28:40 +0000 Subject: [PATCH] upgrade.php: - print query (debug mode) _before_ executing it - upgrade_318_mysql: include CONSTRAINT in CREATE TABLE - otherwise dropping it afterwards fails... git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@319 a1433add-5e2c-0410-b055-b7f2511e0802 --- upgrade.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/upgrade.php b/upgrade.php index 6db640c6..eb37da37 100644 --- a/upgrade.php +++ b/upgrade.php @@ -184,9 +184,11 @@ function db_query_parsed($sql, $ignore_errors = 0, $attach_mysql = "") { $replace['{BOOL_FALSE}'] = db_get_boolean(False); $query = trim(str_replace(array_keys($replace), $replace, $sql)); - $result = db_query($query, $ignore_errors); if (safeget('debug') != "") { print "

$query"; + } + $result = db_query($query, $ignore_errors); + if (safeget('debug') != "") { print "

" . $result['error'] . "
"; } return $result; @@ -543,13 +545,14 @@ function upgrade_169_mysql() { function upgrade_318_mysql() { $table_vacation_notification = table_by_key('vacation_notification'); - # create table without constraint for now... db_query_parsed( " CREATE TABLE {IF_NOT_EXISTS} $table_vacation_notification ( on_vacation varchar(255) NOT NULL, notified varchar(255) NOT NULL, notified_at timestamp NOT NULL default now(), - PRIMARY KEY on_vacation (`on_vacation`, `notified`) + PRIMARY KEY on_vacation (`on_vacation`, `notified`), + CONSTRAINT `vacation_notification_pkey` + FOREIGN KEY (`on_vacation`) REFERENCES vacation(`email`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT {LATIN1} TYPE=InnoDB COMMENT='Postfix Admin - Virtual Vacation Notifications'