diff --git a/src/main/resources/db/migration/mariadb/V255_2__fix_null.sql b/src/main/resources/db/migration/mariadb/V255_2__fix_null.sql new file mode 100644 index 00000000..8254961f --- /dev/null +++ b/src/main/resources/db/migration/mariadb/V255_2__fix_null.sql @@ -0,0 +1,17 @@ +-- maimai2_user_playlog +-- Set ext_bool1 as NOT NULL and give it a default value (e.g., FALSE) +UPDATE maimai2_user_playlog SET ext_bool1 = FALSE WHERE ext_bool1 IS NULL; +ALTER TABLE maimai2_user_playlog MODIFY COLUMN ext_bool1 BOOLEAN NOT NULL DEFAULT FALSE; + +-- Set ext_num4 as NOT NULL (assuming it already has a default value of 0) +UPDATE maimai2_user_playlog SET ext_num4 = 0 WHERE ext_num4 IS NULL; +ALTER TABLE maimai2_user_playlog MODIFY COLUMN ext_num4 INTEGER NOT NULL DEFAULT 0; + +-- maimai2_user_detail +-- Add default value for current_play_count and set it as NOT NULL +UPDATE maimai2_user_detail SET current_play_count = 0 WHERE current_play_count IS NULL; +ALTER TABLE maimai2_user_detail MODIFY COLUMN current_play_count INTEGER NOT NULL DEFAULT 0; + +-- Add default value for rename_credit and set it as NOT NULL +UPDATE maimai2_user_detail SET rename_credit = 0 WHERE rename_credit IS NULL; +ALTER TABLE maimai2_user_detail MODIFY COLUMN rename_credit INTEGER NOT NULL DEFAULT 0; diff --git a/src/main/resources/db/migration/mysql/V255_2__fix_null.sql b/src/main/resources/db/migration/mysql/V255_2__fix_null.sql new file mode 100644 index 00000000..8254961f --- /dev/null +++ b/src/main/resources/db/migration/mysql/V255_2__fix_null.sql @@ -0,0 +1,17 @@ +-- maimai2_user_playlog +-- Set ext_bool1 as NOT NULL and give it a default value (e.g., FALSE) +UPDATE maimai2_user_playlog SET ext_bool1 = FALSE WHERE ext_bool1 IS NULL; +ALTER TABLE maimai2_user_playlog MODIFY COLUMN ext_bool1 BOOLEAN NOT NULL DEFAULT FALSE; + +-- Set ext_num4 as NOT NULL (assuming it already has a default value of 0) +UPDATE maimai2_user_playlog SET ext_num4 = 0 WHERE ext_num4 IS NULL; +ALTER TABLE maimai2_user_playlog MODIFY COLUMN ext_num4 INTEGER NOT NULL DEFAULT 0; + +-- maimai2_user_detail +-- Add default value for current_play_count and set it as NOT NULL +UPDATE maimai2_user_detail SET current_play_count = 0 WHERE current_play_count IS NULL; +ALTER TABLE maimai2_user_detail MODIFY COLUMN current_play_count INTEGER NOT NULL DEFAULT 0; + +-- Add default value for rename_credit and set it as NOT NULL +UPDATE maimai2_user_detail SET rename_credit = 0 WHERE rename_credit IS NULL; +ALTER TABLE maimai2_user_detail MODIFY COLUMN rename_credit INTEGER NOT NULL DEFAULT 0; diff --git a/src/main/resources/db/migration/sqlite/V255_2__fix_null.sql b/src/main/resources/db/migration/sqlite/V255_2__fix_null.sql new file mode 100644 index 00000000..88ab48e1 --- /dev/null +++ b/src/main/resources/db/migration/sqlite/V255_2__fix_null.sql @@ -0,0 +1,3 @@ +UPDATE maimai2_user_playlog SET ext_bool1=false; +UPDATE maimai2_user_detail SET current_play_count=0; +UPDATE maimai2_user_detail SET rename_credit=0; \ No newline at end of file