Add migration 0014 to align search_names field with default INDEX_SEARCH_NAMES setting#309
Add migration 0014 to align search_names field with default INDEX_SEARCH_NAMES setting#309
Conversation
Co-authored-by: marianoeramirez <1028773+marianoeramirez@users.noreply.github.com>
Co-authored-by: marianoeramirez <1028773+marianoeramirez@users.noreply.github.com>
|
@copilot add a verification for make migration |
Co-authored-by: marianoeramirez <1028773+marianoeramirez@users.noreply.github.com>
Co-authored-by: marianoeramirez <1028773+marianoeramirez@users.noreply.github.com>
Added test |
|
@copilot Add a makemigration --check to the tox ini. Not a test for migration |
Co-authored-by: marianoeramirez <1028773+marianoeramirez@users.noreply.github.com>
Added |
…solete migration tests - Introduced a new test environment for makemigrations in tox.ini to streamline migration checks. - Removed the outdated test_migrations.py file, which contained unimplemented tests and was no longer necessary.
|
@copilot This should be fixed in migration 0013 because that's where it fails. Fixing it in 0014 does not help, because the migration has already failed before it even executes. e.g. mysql btw. this also happens for mssql |
Migration 0013 (added in v3.11) sets
db_index=TrueonCity.search_names, butsettings.INDEX_SEARCH_NAMESdefaults toFalsefor PostgreSQL/MySQL databases. This causesmakemigrationsto detect pending changes on fresh installs.Changes
db_indexfromCity.search_namesfield definition to match the default configuration whereCITIES_LIGHT_INDEX_SEARCH_NAMES=FalseINDEX_SEARCH_NAMESdefaults toFalse)tox.inithat runsmakemigrations --check --dry-runfor PostgreSQL and MySQL environments to ensure no pending migrations existContext
The INDEX_SEARCH_NAMES setting was designed to default to False for PostgreSQL/MySQL to avoid index size issues on text fields. Users who explicitly set
CITIES_LIGHT_INDEX_SEARCH_NAMES=Truewill still need to generate their own migration, as documented.Testing
test_migration_0014_resolves_index_search_names_mismatchverifies no pending migrations for PostgreSQL/MySQLThe changes ensure that the migration issue is resolved for PostgreSQL/MySQL users and that CI will catch any future migration inconsistencies for these databases.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.