Use separate select statement instead of hardcoding database name

This commit is contained in:
Timo Smit 2016-08-07 19:09:08 +02:00
parent bb67eb3f69
commit ea90a08989

View file

@ -1,94 +1,95 @@
ALTER TABLE `wolfadmin`.`aliases`
RENAME TO `wolfadmin`.`alias`;
-- new naming convention
ALTER TABLE `aliases`
RENAME TO `alias`;
ALTER TABLE `wolfadmin`.`levels`
RENAME TO `wolfadmin`.`level`;
ALTER TABLE `levels`
RENAME TO `level`;
ALTER TABLE `wolfadmin`.`maps`
RENAME TO `wolfadmin`.`map`;
ALTER TABLE `maps`
RENAME TO `map`;
ALTER TABLE `wolfadmin`.`players`
RENAME TO `wolfadmin`.`player`;
ALTER TABLE `players`
RENAME TO `player`;
ALTER TABLE `wolfadmin`.`records`
RENAME TO `wolfadmin`.`record`;
ALTER TABLE `records`
RENAME TO `record`;
ALTER TABLE `wolfadmin`.`warns`
RENAME TO `wolfadmin`.`warn`;
ALTER TABLE `warns`
RENAME TO `warn`;
ALTER TABLE `wolfadmin`.`alias`
ALTER TABLE `alias`
DROP FOREIGN KEY `aliasplayer`,
DROP INDEX `playerid_idx`;
ALTER TABLE `wolfadmin`.`alias`
ALTER TABLE `alias`
CHANGE COLUMN `player` `player_id` INT(10) UNSIGNED NOT NULL;
ALTER TABLE `wolfadmin`.`alias`
ALTER TABLE `alias`
ADD CONSTRAINT `alias_player`
FOREIGN KEY (`player_id`)
REFERENCES `wolfadmin`.`player` (`id`)
REFERENCES `player` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ADD INDEX `player_idx` (`player_id` ASC);
ALTER TABLE `wolfadmin`.`level`
ALTER TABLE `level`
DROP FOREIGN KEY `levelplayer`,
DROP INDEX `leveladmin_idx`,
DROP FOREIGN KEY `leveladmin`,
DROP INDEX `levelplayer`;
ALTER TABLE `wolfadmin`.`level`
ALTER TABLE `level`
CHANGE COLUMN `player` `player_id` INT(10) UNSIGNED NOT NULL,
CHANGE COLUMN `admin` `admin_id` INT(10) UNSIGNED NOT NULL;
ALTER TABLE `wolfadmin`.`level`
ALTER TABLE `level`
ADD CONSTRAINT `level_player`
FOREIGN KEY (`player_id`)
REFERENCES `wolfadmin`.`player` (`id`)
REFERENCES `player` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ADD INDEX `player_idx` (`player_id` ASC),
ADD CONSTRAINT `level_admin`
FOREIGN KEY (`admin_id`)
REFERENCES `wolfadmin`.`player` (`id`)
REFERENCES `player` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ADD INDEX `admin_idx` (`admin_id` ASC);
ALTER TABLE `wolfadmin`.`record`
ALTER TABLE `record`
DROP FOREIGN KEY `spreemap`,
DROP FOREIGN KEY `kspreeplayer`,
DROP INDEX `ksplayer_idx`;
ALTER TABLE `wolfadmin`.`record`
ALTER TABLE `record`
CHANGE COLUMN `mapid` `map_id` INT(10) UNSIGNED NOT NULL,
CHANGE COLUMN `player` `player_id` INT(10) UNSIGNED NOT NULL;
ALTER TABLE `wolfadmin`.`record`
ALTER TABLE `record`
ADD CONSTRAINT `record_map`
FOREIGN KEY (`map_id`)
REFERENCES `wolfadmin`.`map` (`id`)
REFERENCES `map` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ADD CONSTRAINT `record_player`
FOREIGN KEY (`player_id`)
REFERENCES `wolfadmin`.`player` (`id`)
REFERENCES `player` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ADD INDEX `player_idx` (`player_id` ASC);
ALTER TABLE `wolfadmin`.`warn`
ALTER TABLE `warn`
DROP FOREIGN KEY `warnadmin`,
DROP INDEX `invoker_idx`,
DROP FOREIGN KEY `warnplayer`,
DROP INDEX `playerid_idx`;
ALTER TABLE `wolfadmin`.`warn`
ALTER TABLE `warn`
CHANGE COLUMN `player` `player_id` INT(10) UNSIGNED NOT NULL,
CHANGE COLUMN `admin` `admin_id` INT(10) UNSIGNED NOT NULL;
ALTER TABLE `wolfadmin`.`warn`
ALTER TABLE `warn`
ADD CONSTRAINT `warn_player`
FOREIGN KEY (`player_id`)
REFERENCES `wolfadmin`.`player` (`id`)
REFERENCES `player` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ADD INDEX `player_idx` (`player_id` ASC),
ADD CONSTRAINT `warn_admin`
FOREIGN KEY (`admin_id`)
REFERENCES `wolfadmin`.`player` (`id`)
REFERENCES `player` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ADD INDEX `admin_idx` (`admin_id` ASC);