Existing MySQL databases hit a DataError when the commands/fingerprints JSON blobs exceed 64 KiB (TEXT limit). _BIG_TEXT emits MEDIUMTEXT only at CREATE TABLE time; create_all() is a no-op on existing columns. Add MySQLRepository._migrate_column_types() that queries information_schema and issues ALTER TABLE … MODIFY COLUMN … MEDIUMTEXT for the five affected columns (commands, fingerprints, services, deckies, state.value) whenever they are still TEXT. Called from an overridden initialize() after _migrate_attackers_table() and before create_all(). Add tests/test_mysql_migration.py covering: ALTER issued for TEXT columns, no-op for already-MEDIUMTEXT, idempotency, DEFAULT clause correctness, and initialize() call order.
7.6 KiB
7.6 KiB