1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
# Generated by Django 3.1.5 on 2021-01-18 00:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('testapp', '0010_pizza_topping'),
]
operations = [
migrations.CreateModel(
name='TestUnsupportableUniqueConstraint',
fields=[
(
'id',
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('_type', models.CharField(max_length=50)),
('status', models.CharField(max_length=50)),
],
# Stop Django attempting to automatically create migrations for this table. Instead
# migrations are attempted manually in `test_unsupportable_unique_constraint` where
# they are expected to fail.
options={
'managed': False,
},
),
migrations.CreateModel(
name='TestSupportableUniqueConstraint',
fields=[
(
'id',
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('_type', models.CharField(max_length=50)),
('status', models.CharField(max_length=50)),
],
),
migrations.AddConstraint(
model_name='testsupportableuniqueconstraint',
constraint=models.UniqueConstraint(
condition=models.Q(
('status', 'in_progress'),
('status', 'needs_changes'),
('status', 'published'),
),
fields=('_type',),
name='and_constraint',
),
),
migrations.AddConstraint(
model_name='testsupportableuniqueconstraint',
constraint=models.UniqueConstraint(
condition=models.Q(status__in=['in_progress', 'needs_changes']),
fields=('_type',),
name='in_constraint',
),
),
]
|