forked from science-ation/science-ation
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:
parent
b6f43280d7
commit
ccf1b9c453
@ -1 +1 @@
|
|||||||
197
|
198
|
||||||
|
@ -35,11 +35,6 @@ DROP TABLE `users_conferences_link`;
|
|||||||
-- Add conferences ID to users
|
-- Add conferences ID to users
|
||||||
ALTER TABLE `users` ADD `conferences_id` INT NOT NULL AFTER `accounts_id`;
|
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
|
-- 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` ENUM( 'no', 'yes' ) NOT NULL DEFAULT 'no' AFTER `superuser`;
|
||||||
ALTER TABLE `accounts` ADD `deleted_datetime` DATETIME NOT NULL AFTER `deleted`;
|
ALTER TABLE `accounts` ADD `deleted_datetime` DATETIME NOT NULL AFTER `deleted`;
|
||||||
|
5
db/db.update.198.sql
Normal file
5
db/db.update.198.sql
Normal 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`);
|
||||||
|
|
@ -84,7 +84,11 @@ if($dbcodeversion && $dbdbversion) {
|
|||||||
echo "db.update.$ver.sql detected - running...\n";
|
echo "db.update.$ver.sql detected - running...\n";
|
||||||
readfile("db.update.$ver.sql");
|
readfile("db.update.$ver.sql");
|
||||||
echo "\n";
|
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 {
|
else {
|
||||||
echo "Version $ver SQL update file not found - skipping over\n";
|
echo "Version $ver SQL update file not found - skipping over\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user