From 043b8d2d65bcad02ed04a16a7afe04320a6f1141 Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 19 Dec 2025 11:14:05 +0100 Subject: [PATCH] CI: More MySQL work --- .github/actions/run-tests/action.yml | 6 +++--- .github/workflows/mysql_settings.py | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index 3c1abfb5e9..8427ea09e4 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -66,11 +66,11 @@ runs: cd testing_mygame shell: bash - - name: Set MySQL row format before migrations + - name: Verify MySQL row format before migrations if: ${{ inputs.testing-db == 'mysql' }} working-directory: testing_mygame run: | - python -c "import os; import django; os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.conf.settings'); django.setup(); from django.db import connection; cursor = connection.cursor(); cursor.execute('SET GLOBAL innodb_default_row_format = \"DYNAMIC\"'); cursor.execute('SELECT @@innodb_default_row_format'); result = cursor.fetchone(); print(f'MySQL default row format: {result[0]}')" + python -c "import os; import django; os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.conf.settings'); django.setup(); from django.db import connection; cursor = connection.cursor(); cursor.execute('SELECT @@innodb_default_row_format'); result = cursor.fetchone(); print(f'MySQL default row format (must be DYNAMIC): {result[0]}'); assert result[0] == 'dynamic' or result[0] == 'DYNAMIC', f'Expected DYNAMIC, got {result[0]}'" shell: bash - name: Run migrations @@ -79,7 +79,7 @@ runs: evennia migrate shell: bash - - name: Set MySQL table row format after migrations + - name: Set MySQL table row format after migrations (safety check) if: ${{ inputs.testing-db == 'mysql' }} working-directory: testing_mygame run: | diff --git a/.github/workflows/mysql_settings.py b/.github/workflows/mysql_settings.py index cf9fd9401d..303eaba7f3 100644 --- a/.github/workflows/mysql_settings.py +++ b/.github/workflows/mysql_settings.py @@ -48,13 +48,21 @@ DATABASES = { "PORT": "", # use default port "OPTIONS": { "charset": "utf8mb4", - "init_command": "SET collation_connection=utf8mb4_unicode_ci, sql_mode='STRICT_TRANS_TABLES', innodb_strict_mode=1", + # Note: innodb_default_row_format is set globally in setup-database action + # This ensures all new tables use DYNAMIC format for utf8mb4 long keys + "init_command": ( + "SET collation_connection=utf8mb4_unicode_ci, " + "sql_mode='STRICT_TRANS_TABLES', innodb_strict_mode=1" + ), }, "TEST": { "NAME": "evennia", "OPTIONS": { "charset": "utf8mb4", - "init_command": "SET collation_connection=utf8mb4_unicode_ci, sql_mode='STRICT_TRANS_TABLES', innodb_strict_mode=1", + "init_command": ( + "SET collation_connection=utf8mb4_unicode_ci, " + "sql_mode='STRICT_TRANS_TABLES', innodb_strict_mode=1" + ), }, }, }