mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
On a database NexusDashboard (or a server's own changes) already migrated, 29, 30 and 40 logged an error for every column that was already there, and 40 and 57 added a second index on columns MariaDB had already indexed for the inline REFERENCES foreign keys of 0_initial.sql. Add those columns and indexes only when information_schema says they are missing. 40 also gives pet_names.owner_id values written before 23_store_character_id_as_objectid.sql the persistent bit, as 23 did for every other character id column, so they match characters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
23 lines
1.5 KiB
SQL
23 lines
1.5 KiB
SQL
/* Columns used by the web dashboard. Names match NexusDashboard so databases it already migrated keep their data:
|
|
each column is only added when it is not there yet. */
|
|
SET @dlu_column = (SELECT IF(COUNT(*) = 0, 'ALTER TABLE play_keys ADD COLUMN notes TEXT NULL', 'DO 0') FROM information_schema.columns
|
|
WHERE table_schema = DATABASE() AND table_name = 'play_keys' AND column_name = 'notes');
|
|
PREPARE dlu_column_stmt FROM @dlu_column;
|
|
EXECUTE dlu_column_stmt;
|
|
DEALLOCATE PREPARE dlu_column_stmt;
|
|
SET @dlu_column = (SELECT IF(COUNT(*) = 0, 'ALTER TABLE bug_reports ADD COLUMN resolved_time TIMESTAMP NULL DEFAULT NULL', 'DO 0') FROM information_schema.columns
|
|
WHERE table_schema = DATABASE() AND table_name = 'bug_reports' AND column_name = 'resolved_time');
|
|
PREPARE dlu_column_stmt FROM @dlu_column;
|
|
EXECUTE dlu_column_stmt;
|
|
DEALLOCATE PREPARE dlu_column_stmt;
|
|
SET @dlu_column = (SELECT IF(COUNT(*) = 0, 'ALTER TABLE bug_reports ADD COLUMN resoleved_by_id INT NULL', 'DO 0') FROM information_schema.columns
|
|
WHERE table_schema = DATABASE() AND table_name = 'bug_reports' AND column_name = 'resoleved_by_id');
|
|
PREPARE dlu_column_stmt FROM @dlu_column;
|
|
EXECUTE dlu_column_stmt;
|
|
DEALLOCATE PREPARE dlu_column_stmt;
|
|
SET @dlu_column = (SELECT IF(COUNT(*) = 0, 'ALTER TABLE bug_reports ADD COLUMN resolution TEXT NULL', 'DO 0') FROM information_schema.columns
|
|
WHERE table_schema = DATABASE() AND table_name = 'bug_reports' AND column_name = 'resolution');
|
|
PREPARE dlu_column_stmt FROM @dlu_column;
|
|
EXECUTE dlu_column_stmt;
|
|
DEALLOCATE PREPARE dlu_column_stmt;
|