From 975956b73e4084eaccd72cbd9f897ee38eebd2d4 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sun, 8 Dec 2013 22:12:24 +0000 Subject: [PATCH] upgrade.php: - change {BIGINT} to include "NOT NULL DEFAULT 0" - add {INT} (not used anywhere yet) - upgrade_729: - quota2 table: change "{BIGINT} NOT NULL DEFAULT 0" to "{BIGINT}" to match the above change - note: quota table created with old versions of upgrade.php will not have explicit "NOT NULL DEFAULT 0" for the "current" field (shouldn't hurt) git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1605 a1433add-5e2c-0410-b055-b7f2511e0802 --- upgrade.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/upgrade.php b/upgrade.php index b1bb8ecc..eec602b8 100644 --- a/upgrade.php +++ b/upgrade.php @@ -204,7 +204,8 @@ function db_query_parsed($sql, $ignore_errors = 0, $attach_mysql = "") { '{RENAME_COLUMN}' => 'CHANGE COLUMN', '{MYISAM}' => 'ENGINE=MyISAM', '{INNODB}' => 'ENGINE=InnoDB', - '{BIGINT}' => 'bigint', + '{INT}' => 'integer NOT NULL DEFAULT 0', + '{BIGINT}' => 'bigint NOT NULL DEFAULT 0', '{DATE}' => "timestamp NOT NULL default '2000-01-01'", # MySQL needs a sane default (no default is interpreted as CURRENT_TIMESTAMP, which is ... '{DATECURRENT}' => 'timestamp NOT NULL default CURRENT_TIMESTAMP', # only allowed once per table in MySQL ); @@ -223,7 +224,8 @@ function db_query_parsed($sql, $ignore_errors = 0, $attach_mysql = "") { '{RENAME_COLUMN}' => 'ALTER COLUMN', # PgSQL : ALTER TABLE x RENAME x TO y '{MYISAM}' => '', '{INNODB}' => '', - '{BIGINT}' => 'bigint', + '{INT}' => 'integer NOT NULL DEFAULT 0', + '{BIGINT}' => 'bigint NOT NULL DEFAULT 0', 'int(1)' => 'int', 'int(10)' => 'int', 'int(11)' => 'int', @@ -1208,7 +1210,7 @@ function upgrade_729() { db_query_parsed(" CREATE TABLE {IF_NOT_EXISTS} $table_quota2 ( username VARCHAR(100) {LATIN1} NOT NULL, - bytes {BIGINT} NOT NULL DEFAULT 0, + bytes {BIGINT}, messages integer NOT NULL DEFAULT 0, PRIMARY KEY (username) ) {MYISAM} ;