-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1912 from GiganticMinecraft/removePrimaryKeyFromUuid
playerdataから重複しているuuidのデータを取り除くためのマイグレーションを追加
- Loading branch information
Showing
3 changed files
with
14 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
src/main/resources/db/migration/V1.16.2__Remove_duplicate_playerdata.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
File renamed without changes.
File renamed without changes.