sharedferret/Sparkle-Turntable-Bot — comment on commit 2c4f900312f44bfce9040acdca7ab74f0c284e64
File:  line 0
By sharedferret:

This sequence of SQL queries will migrate your data to the new table layout.

CREATE TABLE USERS (userid VARCHAR(255), username VARCHAR(255), lastseen DATETIME, PRIMARY KEY (userid, username));

INSERT INTO USERS (userid, username, lastseen) SELECT djid, djname, started FROM SONGLIST ORDER BY started asc ON DUPLICATE KEY UPDATE lastseen = SONGLIST.started;

INSERT INTO USERS (userid, username, lastseen) SELECT userid, user, time FROM CHATLOG ORDER BY time asc ON DUPLICATE KEY UPDATE lastseen = CHATLOG.time;

ALTER TABLE SONGLIST DROP COLUMN djname;

ALTER TABLE CHATLOG DROP COLUMN user;