From 126546a9384afc31d4c7dfcdf0dc7227e36edb7b Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Fri, 9 Feb 2024 22:33:54 -0500 Subject: [PATCH] [O] Fix crash due to duplicate keys in maimai2_user_item --- .../db/migration/mariadb/V250__maimai2_item_integrity.sql | 4 ++++ .../db/migration/mysql/V250__maimai2_item_integrity.sql | 4 ++++ .../db/migration/sqlite/V250__maimai2_item_integrity.sql | 1 + 3 files changed, 9 insertions(+) create mode 100644 src/main/resources/db/migration/mariadb/V250__maimai2_item_integrity.sql create mode 100644 src/main/resources/db/migration/mysql/V250__maimai2_item_integrity.sql create mode 100644 src/main/resources/db/migration/sqlite/V250__maimai2_item_integrity.sql diff --git a/src/main/resources/db/migration/mariadb/V250__maimai2_item_integrity.sql b/src/main/resources/db/migration/mariadb/V250__maimai2_item_integrity.sql new file mode 100644 index 00000000..6fe387b4 --- /dev/null +++ b/src/main/resources/db/migration/mariadb/V250__maimai2_item_integrity.sql @@ -0,0 +1,4 @@ +# Fixes crashes due to duplicate keys in maimai2_user_item +alter table maimai2_user_item + add constraint maimai2_user_item_pk + unique (item_kind, item_id, user_id); diff --git a/src/main/resources/db/migration/mysql/V250__maimai2_item_integrity.sql b/src/main/resources/db/migration/mysql/V250__maimai2_item_integrity.sql new file mode 100644 index 00000000..6fe387b4 --- /dev/null +++ b/src/main/resources/db/migration/mysql/V250__maimai2_item_integrity.sql @@ -0,0 +1,4 @@ +# Fixes crashes due to duplicate keys in maimai2_user_item +alter table maimai2_user_item + add constraint maimai2_user_item_pk + unique (item_kind, item_id, user_id); diff --git a/src/main/resources/db/migration/sqlite/V250__maimai2_item_integrity.sql b/src/main/resources/db/migration/sqlite/V250__maimai2_item_integrity.sql new file mode 100644 index 00000000..324c57e5 --- /dev/null +++ b/src/main/resources/db/migration/sqlite/V250__maimai2_item_integrity.sql @@ -0,0 +1 @@ +CREATE UNIQUE INDEX maimai2_user_item_pk ON maimai2_user_item(item_kind, item_id, user_id);