mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-21 15:42:35 +00:00
Condense Database Migrations (#17103)
* Condense Database Migrations Condenses the Database Migrations into a new initial schema. Also adds some instructions to the Database Readme for existing setups. * Update readme/delete changed migrations since pr creation * Reworks a bit how the previous migrations are handled and updates the instructions accordingly * Expand the readme with baseline/migrate --------- Co-authored-by: Werner <Arrow768@users.noreply.github.com>
This commit is contained in:
29
SQL/migrate-2017/V021__combine_tables.sql
Normal file
29
SQL/migrate-2017/V021__combine_tables.sql
Normal file
@@ -0,0 +1,29 @@
|
||||
--
|
||||
-- Combines the ss13_admin and ss13_player table
|
||||
--
|
||||
ALTER TABLE `ss13_player`
|
||||
ADD COLUMN `rank` VARCHAR(32) NULL DEFAULT NULL AFTER `migration_status`,
|
||||
ADD COLUMN `flags` INT(32) UNSIGNED NOT NULL DEFAULT '0',
|
||||
ADD COLUMN `discord_id` VARCHAR(45) NULL DEFAULT NULL AFTER `flags`;
|
||||
|
||||
UPDATE `ss13_admin`
|
||||
SET `flags` = 0
|
||||
WHERE `rank` = "Removed";
|
||||
|
||||
UPDATE `ss13_player`
|
||||
INNER JOIN `ss13_admin` ON ss13_admin.ckey = ss13_player.ckey
|
||||
SET
|
||||
ss13_player.rank = ss13_admin.rank,
|
||||
ss13_player.flags = ss13_admin.flags,
|
||||
ss13_player.discord_id = ss13_admin.discord_id;
|
||||
|
||||
UPDATE `ss13_player`
|
||||
SET `rank` = NULL
|
||||
WHERE `rank` = "Removed";
|
||||
|
||||
ALTER TABLE `ss13_admin`
|
||||
DROP FOREIGN KEY `ckey`;
|
||||
|
||||
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
||||
DROP TABLE `ss13_admin`;
|
||||
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
||||
Reference in New Issue
Block a user