#33652: Skip ExclusionConstraint on non-PostgreSQL databases.
-------------------------------------+-------------------------------------
     Reporter:  hottwaj              |                    Owner:  nobody
         Type:  New feature          |                   Status:  closed
    Component:  Migrations           |                  Version:  dev
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:  postgres exclusion   |             Triage Stage:
  constraint                         |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

 * status:  new => closed
 * resolution:   => wontfix
 * component:  Database layer (models, ORM) => Migrations


Comment:

 Thanks for this report. We strongly recommend that you use the same
 database for testing and a real-life apps. There are many differences and
 you may encounter unexpected issues by using a different backend for
 testing. Therefore, we don't want to encourage users to do this by
 automatically skipping PostgreSQL-specific features. If you really have to
 do this you can skip PostgreSQL constraints/indexes in migration files,
 e.g.
 {{{#!python
 class Migration(migrations.Migration):

     dependencies = [
         ('test_33652', '0001_initial'),
     ]

     if connection.vendor == 'postgresql':
         operations = [
             migrations.AddConstraint(
                 model_name='hotelreservation',
 
constraint=django.contrib.postgres.constraints.ExclusionConstraint(condition=models.Q(('cancelled',
 False)), expressions=[('room', '=')],
 name='exclude_overlapping_reservations'),
             ),
         ]
     else:
         operations = []
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33652#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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701806030bbff-3ac1b67c-4cfb-41aa-81c1-cf92d6b24131-000000%40eu-central-1.amazonses.com.

Reply via email to