Changes between Version 1 and Version 2 of Ticket #35311


Ignore:
Timestamp:
Mar 16, 2024, 5:29:52 AM (8 months ago)
Author:
Tim Graham
Comment:

Duplicate of #33021. django.contrib.postgres must be in INSTALLED_APPS when using OpClass(). See docs and related ticket #32770.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35311

    • Property Resolutionduplicate
    • Property Status newclosed
  • Ticket #35311 – Description

    v1 v2  
    33I created a Gin Index using :
    44
    5 ''GinIndex(OpClass(Lower('title'),      name='gin_trgm_ops'), name="name_gin_trgm_title_affaire"),''
     5{{{
     6GinIndex(OpClass(Lower('title'),      name='gin_trgm_ops'), name="name_gin_trgm_title_affaire"),'
     7}}}
    68
    79makemigrations generates the following code :
    810
    9 ''migrations.AddIndex(
     11{{{
     12migrations.AddIndex(
    1013           '' model_name='affaire',
    1114            index=django.contrib.postgres.indexes.GinIndex(django.contrib.postgres.indexes.OpClass(django.db.models.functions.text.Lower('title'), name='gin_trgm_ops'), name='name_gin_trgm_title_affaire'),''
    1215        ),''
    13 
     16}}}
    1417SQLMIGRATE generates a wrong code :
    1518
    16 ''CREATE INDEX "name_gin_trgm_title_affaire" ON "affaires_affaire" USING gin ((LOWER("title"), name=gin_trgm_ops));''
    17 
     19{{{
     20CREATE INDEX "name_gin_trgm_title_affaire" ON "affaires_affaire" USING gin ((LOWER("title"), name=gin_trgm_ops));''
     21}}}
    1822Instead of (too many parenthesis) :
    1923
    20 ''CREATE INDEX "name_gin_trgm_title_affaire" ON "affaires_affaire" USING gin (LOWER("title"),  name=gin_trgm_ops);''
     24{{{
     25CREATE INDEX "name_gin_trgm_title_affaire" ON "affaires_affaire" USING gin (LOWER("title"),  name=gin_trgm_ops);''
     26}}}
    2127
    2228There is a manual workaround, but its annoying.
Back to Top