diff --git a/patches/patch20250130-8.0.1/patch.sh b/patches/patch20250130-8.0.1/patch.sh index bad63f1dc17ab102879651293d550c3c44c400a3..863d1124ad932c6c3193ea724c022a40fb1bf1f7 100755 --- a/patches/patch20250130-8.0.1/patch.sh +++ b/patches/patch20250130-8.0.1/patch.sh @@ -36,11 +36,22 @@ check_version $OLD_VERSION # Update charsets and collations. +# Remove some constraints first. +mysql_execute 'ALTER TABLE user_info DROP FOREIGN KEY `subjects_ibfk_2`;' + # Get all tables, drop first line, take first column tables=$(mysql_execute "SHOW TABLE status where Collation='utf8mb3_unicode_ci';" -B | tail +2 | awk '{print $1}') for table in $tables; do mysql_execute "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE uca1400_as_ci;" done + +# Add constraints again. +mysql_execute 'ALTER TABLE user_info MODIFY COLUMN `entity` VARCHAR(255) COLLATE utf8mb4_bin DEFAULT NULL;' +mysql_execute 'ALTER TABLE user_info ADD CONSTRAINT `subjects_ibfk_2` FOREIGN KEY (`entity`) REFERENCES `entity_ids` (`id`);' + + + + # mysql_execute "UPDATE data_type SET datatype=17 WHERE datatype=3"