From 7d5930865ca2348ba454ea401f1cd7ef3f269984 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Tue, 21 May 2024 17:43:04 +0200 Subject: [PATCH] DB/Setup * fix erronous foreign key constraint revealed by MySQL 8.4 --- setup/db_structure.sql | 4 ++-- setup/updates/1716305876_01.sql | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 setup/updates/1716305876_01.sql diff --git a/setup/db_structure.sql b/setup/db_structure.sql index e209feeb..0ffd601b 100644 --- a/setup/db_structure.sql +++ b/setup/db_structure.sql @@ -209,7 +209,7 @@ CREATE TABLE `aowow_account_weightscales` ( `name` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL, `class` tinyint(3) unsigned NOT NULL DEFAULT 0, `icon` varchar(48) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - PRIMARY KEY (`id`,`userId`), + PRIMARY KEY (`id`), KEY `FK_acc_weights` (`userId`), CONSTRAINT `FK_acc_weights` FOREIGN KEY (`userId`) REFERENCES `aowow_account` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPACT; @@ -3250,7 +3250,7 @@ UNLOCK TABLES; LOCK TABLES `aowow_dbversion` WRITE; /*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */; -INSERT INTO `aowow_dbversion` VALUES (1709133536,0,NULL,NULL); +INSERT INTO `aowow_dbversion` VALUES (1716305877,0,NULL,NULL); /*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */; UNLOCK TABLES; diff --git a/setup/updates/1716305876_01.sql b/setup/updates/1716305876_01.sql new file mode 100644 index 00000000..434c71b5 --- /dev/null +++ b/setup/updates/1716305876_01.sql @@ -0,0 +1,7 @@ +SET foreign_key_checks = 0; + +ALTER TABLE `aowow_account_weightscales` + DROP PRIMARY KEY, + ADD PRIMARY KEY (`id`); + +SET foreign_key_checks = 1;