From ccf1b9c453e6098c4e9e4874e4b3a4cf5996d394 Mon Sep 17 00:00:00 2001 From: dave Date: Tue, 13 Jul 2010 04:25:00 +0000 Subject: [PATCH] Fix an update bug. The code needs to be run to set the conference ID before we can build a UNIQUE index on the conference id. --- db/db.code.version.txt | 2 +- db/db.update.197.sql | 5 ----- db/db.update.198.sql | 5 +++++ db/db_update.php | 6 +++++- 4 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 db/db.update.198.sql diff --git a/db/db.code.version.txt b/db/db.code.version.txt index 5381652..ca55a6c 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -197 +198 diff --git a/db/db.update.197.sql b/db/db.update.197.sql index f899127..2792516 100644 --- a/db/db.update.197.sql +++ b/db/db.update.197.sql @@ -35,11 +35,6 @@ DROP TABLE `users_conferences_link`; -- Add conferences ID to users ALTER TABLE `users` ADD `conferences_id` INT NOT NULL AFTER `accounts_id`; --- Change the (unique) index in the users table from (username,year) --- to (accounts_id,conferences_id) -ALTER TABLE `users` DROP INDEX `username`; -ALTER TABLE `users` ADD UNIQUE (`accounts_id` , `conferences_id`); - -- Add deleted/deleted_datetime data to the accounts table ALTER TABLE `accounts` ADD `deleted` ENUM( 'no', 'yes' ) NOT NULL DEFAULT 'no' AFTER `superuser`; ALTER TABLE `accounts` ADD `deleted_datetime` DATETIME NOT NULL AFTER `deleted`; diff --git a/db/db.update.198.sql b/db/db.update.198.sql new file mode 100644 index 0000000..da2759a --- /dev/null +++ b/db/db.update.198.sql @@ -0,0 +1,5 @@ +-- Change the (unique) index in the users table from (username,year) +-- to (accounts_id,conferences_id) +ALTER TABLE `users` DROP INDEX `username`; +ALTER TABLE `users` ADD UNIQUE (`accounts_id` , `conferences_id`); + diff --git a/db/db_update.php b/db/db_update.php index 36996b6..36eb198 100644 --- a/db/db_update.php +++ b/db/db_update.php @@ -84,7 +84,11 @@ if($dbcodeversion && $dbdbversion) { echo "db.update.$ver.sql detected - running...\n"; readfile("db.update.$ver.sql"); echo "\n"; - system("mysql --default-character-set=utf8 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME