[Django] #30805: django 2.x is giving programming error while migrating "migrations.AlterUniqueTogether" part of migration

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django] #30805: django 2.x is giving programming error while migrating "migrations.AlterUniqueTogether" part of migration

Django
#30805: django 2.x is giving programming error while migrating
"migrations.AlterUniqueTogether" part of migration
-------------------------------------------+------------------------
               Reporter:  anveshagarwal    |          Owner:  (none)
                   Type:  Bug              |         Status:  new
              Component:  Error reporting  |        Version:  2.2
               Severity:  Normal           |       Keywords:
           Triage Stage:  Unreviewed       |      Has patch:  0
    Needs documentation:  0                |    Needs tests:  0
Patch needs improvement:  0                |  Easy pickings:  0
                  UI/UX:  0                |
-------------------------------------------+------------------------
 problem is while migrating my migrations in django 2.x(previously using
 1.11 and everything was working fine) , the query generated by the django
 is not correct for "migrations.AlterUniqueTogether" part of migrations.

 It is missing 'double quotes' while generating the sql query for
 particularly "migrations.AlterUniqueTogether()" .
 A small traceback is here:

 {{{
   File "/lib/python3.7/site-packages/django/db/backends/utils.py", line
 85, in _execute
     return self.cursor.execute(sql, params)
   File "//lib/python3.7/site-packages/django/db/utils.py", line 89, in
 __exit__
     raise dj_exc_value.with_traceback(traceback) from exc_value
   File "/lib/python3.7/site-packages/django/db/backends/utils.py", line
 85, in _execute
     return self.cursor.execute(sql, params)
 django.db.utils.ProgrammingError: syntax error at or near "."
 LINE 1: ...eways.juspay_juspayrefund" ADD CONSTRAINT gateways.juspay_ju...

 }}}


 i have hundreds of {{{migrations.AlterUniqueTogether()}}} in migrations
 but it is showing error for only few.

 so to confirm the sql query generated by the django from the migration
 files...

 i used {{{ python manage.py sqlmigrate <app name> <migration file number>
 }}} (in django 2.0)

 so the result was


 {{{
 ALTER TABLE "gateways.juspay_juspayrefund" ADD CONSTRAINT
 gateways.juspay_juspayre_refund_type_id_refund_ob_c256672d_uniq UNIQUE
 ("refund_type_id", "refund_object_id");

 ALTER TABLE "gateways.juspay_juspayorder" ADD CONSTRAINT
 "gateways.juspay_jusp_attempt_id_799d9fbb_fk_gateways_" FOREIGN KEY
 ("attempt_id") REFERENCES "gateways_attempt" ("id") DEFERRABLE INITIALLY
 DEFERRED;

 }}}

 here we have double quotes (" ") missing in ADD CONSTRAINT ...UNIQUE which
 is not letting me to migrate and hence i cant upgrade to django 2.x

 while the result in django 1.11 is

 {{{
 ALTER TABLE "gateways.juspay_juspayrefund" ADD CONSTRAINT
 "gateways.juspay_juspayre_refund_type_id_refund_ob_c256672d_uniq" UNIQUE
 ("refund_type_id", "refund_object_id");

 ALTER TABLE "gateways.juspay_juspayorder" ADD CONSTRAINT
 "gateways.juspay_jusp_attempt_id_799d9fbb_fk_gateways_" FOREIGN KEY
 ("attempt_id") REFERENCES "gateways_attempt" ("id") DEFERRABLE INITIALLY
 DEFERRED;

 }}}

 it is having proper double quotes (" ")

--
Ticket URL: <https://code.djangoproject.com/ticket/30805>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/056.3e6edd92187963cff2fb595c391793ba%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30805: django 2.x is giving programming error while migrating "migrations.AlterUniqueTogether" part of migration

Django
#30805: django 2.x is giving programming error while migrating
"migrations.AlterUniqueTogether" part of migration
---------------------------------+--------------------------------------
     Reporter:  anveshagarwal    |                    Owner:  (none)
         Type:  Bug              |                   Status:  new
    Component:  Error reporting  |                  Version:  2.2
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Unreviewed
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------

Comment (by Simon Charette):

 Thank you for your report.

 Just to make it easier to reproduce.

 Which database backend are you using (this looks like PostgreSQL) and do
 you have a `justpay.JustPayOrder.Meta.db_table` override? Django doesn't
 generate table names like that by default, are you trying to use
 PostgreSQL schemas?

--
Ticket URL: <https://code.djangoproject.com/ticket/30805#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/071.b0b1c0b024d472533cf96f00340e5119%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30805: django 2.x is giving programming error while migrating "migrations.AlterUniqueTogether" part of migration

Django
In reply to this post by Django
#30805: django 2.x is giving programming error while migrating
"migrations.AlterUniqueTogether" part of migration
---------------------------------+--------------------------------------
     Reporter:  anveshagarwal    |                    Owner:  (none)
         Type:  Bug              |                   Status:  new
    Component:  Error reporting  |                  Version:  2.2
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Unreviewed
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------

Comment (by anveshagarwal):

 yes i am using PostgreSQL. And neither am i using PostgreSQL schema and
 nor i am trying to override the {{{ justpay.JustPayOrder.Meta.db_table
 }}}.

--
Ticket URL: <https://code.djangoproject.com/ticket/30805#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/071.0fbf363a891c30c8f5a2c2b023b6fdcd%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30805: django 2.x is giving programming error while migrating "migrations.AlterUniqueTogether" part of migration

Django
In reply to this post by Django
#30805: django 2.x is giving programming error while migrating
"migrations.AlterUniqueTogether" part of migration
---------------------------------+--------------------------------------
     Reporter:  Anvesh Agarwal   |                    Owner:  (none)
         Type:  Bug              |                   Status:  closed
    Component:  Error reporting  |                  Version:  2.0
     Severity:  Normal           |               Resolution:  duplicate
     Keywords:                   |             Triage Stage:  Unreviewed
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------
Changes (by Simon Charette):

 * status:  new => closed
 * version:  2.2 => 2.0
 * resolution:   => duplicate


Comment:

 Duplicate of #29778 which is fixed in Django 2.1+.

--
Ticket URL: <https://code.djangoproject.com/ticket/30805#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/071.5daf3034a8c78c5af3ba48d1dbdfce36%40djangoproject.com.