From c544c20941bb4e38fa6e7755346bfb3f19046890 Mon Sep 17 00:00:00 2001 From: rito528 Date: Sat, 25 Feb 2023 20:04:06 +0900 Subject: [PATCH 1/3] =?UTF-8?q?chore:=20vote=E3=83=86=E3=83=BC=E3=83=96?= =?UTF-8?q?=E3=83=AB=E3=81=AEuuid=E3=82=AB=E3=83=A9=E3=83=A0=E3=81=8B?= =?UTF-8?q?=E3=82=89primary=5Fkey=E3=82=92=E5=A4=96=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/db/migration/V1.16.2__Move_vote_column.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/db/migration/V1.16.2__Move_vote_column.sql b/src/main/resources/db/migration/V1.16.2__Move_vote_column.sql index ffe210598a..cd0881de5c 100644 --- a/src/main/resources/db/migration/V1.16.2__Move_vote_column.sql +++ b/src/main/resources/db/migration/V1.16.2__Move_vote_column.sql @@ -1,7 +1,7 @@ USE seichiassist; CREATE TABLE IF NOT EXISTS vote( - uuid CHAR(36) NOT NULL PRIMARY KEY, + uuid CHAR(36) NOT NULL, vote_number INT NOT NULL, chain_vote_number INT NOT NULL, effect_point INT NOT NULL, From 33b2f7590c3f55f58a97abb5d5a663a40d1b0e14 Mon Sep 17 00:00:00 2001 From: rito528 Date: Sat, 25 Feb 2023 20:28:03 +0900 Subject: [PATCH 2/3] =?UTF-8?q?chore:=20playerdata=E3=83=86=E3=83=BC?= =?UTF-8?q?=E3=83=96=E3=83=AB=E3=81=8B=E3=82=89uuid=E3=82=AB=E3=83=A9?= =?UTF-8?q?=E3=83=A0=E3=81=8C=E9=87=8D=E8=A4=87=E3=81=97=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=82=8B=E3=83=87=E3=83=BC=E3=82=BF=E3=82=92=E5=8F=96=E3=82=8A?= =?UTF-8?q?=E9=99=A4=E3=81=8F=E3=83=9E=E3=82=A4=E3=82=B0=E3=83=AC=E3=83=BC?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../V1.16.2__Remove_duplicate_playerdata.sql | 14 ++++++++++++++ ...te_column.sql => V1.16.3__Move_vote_column.sql} | 2 +- ...umn.sql => V1.16.4__Move_vote_fairy_column.sql} | 0 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/db/migration/V1.16.2__Remove_duplicate_playerdata.sql rename src/main/resources/db/migration/{V1.16.2__Move_vote_column.sql => V1.16.3__Move_vote_column.sql} (94%) rename src/main/resources/db/migration/{V1.16.3__Move_vote_fairy_column.sql => V1.16.4__Move_vote_fairy_column.sql} (100%) diff --git a/src/main/resources/db/migration/V1.16.2__Remove_duplicate_playerdata.sql b/src/main/resources/db/migration/V1.16.2__Remove_duplicate_playerdata.sql new file mode 100644 index 0000000000..6d1275bb03 --- /dev/null +++ b/src/main/resources/db/migration/V1.16.2__Remove_duplicate_playerdata.sql @@ -0,0 +1,14 @@ +-- 本来重複しないはずのuuidにunique制約をかけていなかった & +-- それによって何故か全く同じデータをもつデータがplayerdataテーブルに存在しているのでそれを取り除く + +USE seichiassist; + +CREATE TEMPORARY TABLE playerdata_tmp AS SELECT DISTINCT * FROM playerdata; +DELETE FROM playerdata; + +INSERT INTO playerdata SELECT * FROM playerdata_tmp; +DROP TABLE playerdata_tmp; + +-- ゆるせないのでplayerdataテーブルのuuidカラムをprimary keyとして設定する + +ALTER TABLE playerdata ADD PRIMARY KEY(uuid) diff --git a/src/main/resources/db/migration/V1.16.2__Move_vote_column.sql b/src/main/resources/db/migration/V1.16.3__Move_vote_column.sql similarity index 94% rename from src/main/resources/db/migration/V1.16.2__Move_vote_column.sql rename to src/main/resources/db/migration/V1.16.3__Move_vote_column.sql index cd0881de5c..ffe210598a 100644 --- a/src/main/resources/db/migration/V1.16.2__Move_vote_column.sql +++ b/src/main/resources/db/migration/V1.16.3__Move_vote_column.sql @@ -1,7 +1,7 @@ USE seichiassist; CREATE TABLE IF NOT EXISTS vote( - uuid CHAR(36) NOT NULL, + uuid CHAR(36) NOT NULL PRIMARY KEY, vote_number INT NOT NULL, chain_vote_number INT NOT NULL, effect_point INT NOT NULL, diff --git a/src/main/resources/db/migration/V1.16.3__Move_vote_fairy_column.sql b/src/main/resources/db/migration/V1.16.4__Move_vote_fairy_column.sql similarity index 100% rename from src/main/resources/db/migration/V1.16.3__Move_vote_fairy_column.sql rename to src/main/resources/db/migration/V1.16.4__Move_vote_fairy_column.sql From 72a69b22dd69fd4559806728a6c613a6596a1ae7 Mon Sep 17 00:00:00 2001 From: rito528 Date: Sat, 25 Feb 2023 20:32:56 +0900 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20delete=20from=20=E3=81=A7=E3=81=AF?= =?UTF-8?q?=E3=81=AA=E3=81=8F=20truncate=20table=E3=82=92=E4=BD=BF?= =?UTF-8?q?=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V1.16.2__Remove_duplicate_playerdata.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/db/migration/V1.16.2__Remove_duplicate_playerdata.sql b/src/main/resources/db/migration/V1.16.2__Remove_duplicate_playerdata.sql index 6d1275bb03..7d51ecbf95 100644 --- a/src/main/resources/db/migration/V1.16.2__Remove_duplicate_playerdata.sql +++ b/src/main/resources/db/migration/V1.16.2__Remove_duplicate_playerdata.sql @@ -4,7 +4,7 @@ USE seichiassist; CREATE TEMPORARY TABLE playerdata_tmp AS SELECT DISTINCT * FROM playerdata; -DELETE FROM playerdata; +TRUNCATE TABLE playerdata; INSERT INTO playerdata SELECT * FROM playerdata_tmp; DROP TABLE playerdata_tmp;