From 8a349f630e742e0b1b613f8c0b02d077503cc1c1 Mon Sep 17 00:00:00 2001 From: Dom Eori <4j6dq2zi8@relay.firefox.com> Date: Sun, 10 Apr 2022 02:10:52 +0900 Subject: [PATCH] [chusan] Fix map_area_id data type in chusan_user_map_area table --- .../mysql/V95__fix_chusan_map_area_table.sql | 3 +++ .../sqlite/V95__fix_chusan_map_area_table.sql | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/main/resources/db/migration/mysql/V95__fix_chusan_map_area_table.sql create mode 100644 src/main/resources/db/migration/sqlite/V95__fix_chusan_map_area_table.sql diff --git a/src/main/resources/db/migration/mysql/V95__fix_chusan_map_area_table.sql b/src/main/resources/db/migration/mysql/V95__fix_chusan_map_area_table.sql new file mode 100644 index 00000000..2c93a9d4 --- /dev/null +++ b/src/main/resources/db/migration/mysql/V95__fix_chusan_map_area_table.sql @@ -0,0 +1,3 @@ +-- chusan_user_map_area + +ALTER TABLE `chusan_user_map_area` MODIFY map_area_id INTEGER; diff --git a/src/main/resources/db/migration/sqlite/V95__fix_chusan_map_area_table.sql b/src/main/resources/db/migration/sqlite/V95__fix_chusan_map_area_table.sql new file mode 100644 index 00000000..434dbaf6 --- /dev/null +++ b/src/main/resources/db/migration/sqlite/V95__fix_chusan_map_area_table.sql @@ -0,0 +1,26 @@ +-- chusan_user_map_area + +CREATE TEMPORARY TABLE temp AS SELECT * FROM chusan_user_map_area; +DROP TABLE chusan_user_map_area; + +CREATE TABLE chusan_user_map_area ( + id INTEGER, + is_clear BOOLEAN NOT NULL, + is_locked BOOLEAN NOT NULL, + map_area_id INTEGER NOT NULL, + position INTEGER NOT NULL, + rate INTEGER NOT NULL, + status_count INTEGER NOT NULL, + remain_grid_count INTEGER NOT NULL, + user_id BIGINT REFERENCES chusan_user_data (id) ON DELETE CASCADE, + PRIMARY KEY ( + id + ), + CONSTRAINT chusan_user_map_uq UNIQUE ( + map_area_id, + user_id + ) +); + +INSERT INTO chusan_user_map_area SELECT * FROM temp; +DROP TABLE temp; \ No newline at end of file