#31167: Unable to delete or modify a constraint using model Meta
------------------------------------+--------------------------------------
     Reporter:  BITSOLVER           |                    Owner:  nobody
         Type:  Uncategorized       |                   Status:  new
    Component:  Migrations          |                  Version:  2.2
     Severity:  Normal              |               Resolution:
     Keywords:  Migrations, unique  |             Triage Stage:  Unreviewed
    Has patch:  0                   |      Needs documentation:  0
  Needs tests:  0                   |  Patch needs improvement:  0
Easy pickings:  0                   |                    UI/UX:  0
------------------------------------+--------------------------------------

Comment (by BITSOLVER):

 On further investigation a previous migration had:

 {{{
 # Generated by Django 2.2.5 on 2019-09-30 13:40

 from django.db import migrations, models


 class Migration(migrations.Migration):

     dependencies = [
         ('venue', '0008_standardcommunitycentreprice_venues'),
     ]

     operations = [
         migrations.RemoveConstraint(
             model_name='standardcommunitycentrepricelist',
             name='unique_standard_community_price_list',
         ),
         migrations.AddConstraint(
             model_name='standardcommunitycentrepricelist',
             constraint=models.UniqueConstraint(fields=('customer_type',
 'customer'), name='unique_standard_community_price_list'),
         ),
         migrations.RemoveField(
             model_name='standardcommunitycentrepricelist',
             name='code',
         ),
         migrations.AlterField(
             model_name='standardcommunitycentreprice',
             name='day_of_week',
             field=models.IntegerField(choices=[(None, 'Any'), (1,
 'Monday'), (2, 'Tuesday'), (3, 'Wednesday'), (4, 'Thursday'), (5,
 'Friday'), (6, 'Saturday'), (7, 'Sunday')], null=True),
         ),
     ]

 }}}

 And if I delete remove constraint from the latest migration then run
 migrate then the migrations completes.

 If I then run makemigrations venue again it creates a remove constraint,
 run again then it creates and add migration back.

 Everything is back in sync now, I just wonder if something odd went on
 with the order of operations for remove & add unique constraints?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31167#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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.814caa471ace825111659221ac38bf55%40djangoproject.com.

Reply via email to