diff --git a/src/cities_light/migrations/0014_alter_city_search_names.py b/src/cities_light/migrations/0014_alter_city_search_names.py new file mode 100644 index 00000000..8ec47f6d --- /dev/null +++ b/src/cities_light/migrations/0014_alter_city_search_names.py @@ -0,0 +1,19 @@ +# Generated by Django 6.0.2 on 2026-02-16 17:06 + +import cities_light.abstract_models +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('cities_light', '0013_alter_city_alternate_names_alter_city_country_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='city', + name='search_names', + field=cities_light.abstract_models.ToSearchTextField(blank=True, default='', max_length=4000, verbose_name='search names'), + ), + ] diff --git a/src/cities_light/settings.py b/src/cities_light/settings.py index c0313d22..4e9e6c5a 100644 --- a/src/cities_light/settings.py +++ b/src/cities_light/settings.py @@ -89,8 +89,7 @@ using several databases for your project. Notes: - - MySQL doesn't support indexing TextFields. - - PostgreSQL supports indexing TextFields, but it is not enabled by default + - PostgreSQL and MySQL supports indexing TextFields, but it is not enabled by default in cities_light because the lenght of the field can be too long for btree for more information please visit #273 @@ -200,16 +199,9 @@ ], ) -# MySQL doesn't support indexing TextFields -INDEX_SEARCH_NAMES = getattr(settings, "CITIES_LIGHT_INDEX_SEARCH_NAMES", None) -if INDEX_SEARCH_NAMES is None: - INDEX_SEARCH_NAMES = True - for database in list(settings.DATABASES.values()): - if "ENGINE" in database and ( - "mysql" in database.get("ENGINE").lower() - or "postgresql" in database.get("ENGINE").lower() - ): - INDEX_SEARCH_NAMES = False + +INDEX_SEARCH_NAMES = getattr(settings, "CITIES_LIGHT_INDEX_SEARCH_NAMES", False) + DEFAULT_APP_NAME = "cities_light" CITIES_LIGHT_APP_NAME = getattr(settings, "CITIES_LIGHT_APP_NAME", DEFAULT_APP_NAME)