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);