Skip to content

Commit

Permalink
sql: Add migration for mxq_daemon.tags
Browse files Browse the repository at this point in the history
We want to rename prerequisites to tags. Additionally, we want a new
column prerequisites with new data. However, we can't go the direct
way (CHANGE COLUMN prerequisites tags...), because the running mxqd
processes use the old name.

Create a new column with the new name and copy the data over. We don't
really care to much, if data is lost because a mxq daemon restarts
during the migration phase, because the former prerequisites and now tags
column is only published into the database.

Additionally, fix length of prerequisites from 1024 to 1000.
  • Loading branch information
donald committed Mar 29, 2021
1 parent cba024c commit 3b01ae1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mysql/migrate_010_add_mxq_daemon_tags.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ALTER TABLE mxq_daemon MODIFY COLUMN prerequisites VARCHAR(1000) NOT NULL DEFAULT '';

ALTER TABLE mxq_daemon
ADD COLUMN
tags VARCHAR(1000) NOT NULL DEFAULT ''
AFTER
prerequisites;

UPDATE mxq_daemon SET tags=prerequisites;

0 comments on commit 3b01ae1

Please sign in to comment.