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.
This commit is contained in:
dave 2010-07-13 04:25:00 +00:00
parent b6f43280d7
commit ccf1b9c453
4 changed files with 11 additions and 7 deletions

View File

@ -1 +1 @@
197
198

View File

@ -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`;

5
db/db.update.198.sql Normal file
View File

@ -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`);

View File

@ -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 <db.update.$ver.sql");
system("mysql --default-character-set=utf8 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db.update.$ver.sql", $exit_code);
if($exit_code != 0) {
/* mysql failed!, what now? */
}
}
else {
echo "Version $ver SQL update file not found - skipping over\n";