From c398b564e1855a4c66bbabcb43ad8da8b308420d Mon Sep 17 00:00:00 2001 From: Christian Weiske <cweiske@cweiske.de> Date: Sun, 15 Sep 2024 13:08:57 +0200 Subject: [PATCH] How to migrate to the new database structure --- data/sql.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 data/sql.txt diff --git a/data/sql.txt b/data/sql.txt new file mode 100644 index 0000000..f12737c --- /dev/null +++ b/data/sql.txt @@ -0,0 +1,10 @@ +Migrate users from gamesticks table to users table: + +INSERT INTO users (id, gamerTag, founderFlag, founderName, minAge, avatar, created_at, updated_at) SELECT id, gamerTag, founderFlag, founderName, minAge, avatar, created_at, updated_at FROM gamesticks; +ALTER TABLE gamesticks ADD userId INTEGER DEFAULT NULL; +UPDATE gamesticks SET userId = id; +ALTER TABLE gamesticks DROP gamerTag; +ALTER TABLE gamesticks DROP founderFlag; +ALTER TABLE gamesticks DROP founderName; +ALTER TABLE gamesticks DROP minAge; +ALTER TABLE gamesticks DROP avatar; -- 2.30.2