Skip to content

Commit

Permalink
Merge pull request #1912 from GiganticMinecraft/removePrimaryKeyFromUuid
Browse files Browse the repository at this point in the history
playerdataから重複しているuuidのデータを取り除くためのマイグレーションを追加
  • Loading branch information
Lucky3028 authored Feb 25, 2023
2 parents 643f2c5 + 72a69b2 commit a56ec23
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- 本来重複しないはずのuuidにunique制約をかけていなかった &
-- それによって何故か全く同じデータをもつデータがplayerdataテーブルに存在しているのでそれを取り除く

USE seichiassist;

CREATE TEMPORARY TABLE playerdata_tmp AS SELECT DISTINCT * FROM playerdata;
TRUNCATE TABLE playerdata;

INSERT INTO playerdata SELECT * FROM playerdata_tmp;
DROP TABLE playerdata_tmp;

-- ゆるせないのでplayerdataテーブルのuuidカラムをprimary keyとして設定する

ALTER TABLE playerdata ADD PRIMARY KEY(uuid)

0 comments on commit a56ec23

Please sign in to comment.