1 | # Generated by Django 2.0.4 on 2018-04-20 12:44
|
---|
2 |
|
---|
3 | from django.db import migrations, models
|
---|
4 | import django.db.models.deletion
|
---|
5 |
|
---|
6 |
|
---|
7 | class Migration(migrations.Migration):
|
---|
8 |
|
---|
9 | initial = True
|
---|
10 |
|
---|
11 | dependencies = [
|
---|
12 | ]
|
---|
13 |
|
---|
14 | operations = [
|
---|
15 | # Creates the table `testschema.migration_app_test`
|
---|
16 | migrations.CreateModel(
|
---|
17 | name='Test',
|
---|
18 | fields=[
|
---|
19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
---|
20 | ],
|
---|
21 | ),
|
---|
22 |
|
---|
23 | # Creates the table `testschema.migration_app_testref` with foregin key constraint:
|
---|
24 | # "migration_app_testref_test_id_bce0807a_fk_migration_app_test_id" FOREIGN KEY (test_id) REFERENCES migration_app_test(id) DEFERRABLE INITIALLY DEFERRED
|
---|
25 | migrations.CreateModel(
|
---|
26 | name='TestRef',
|
---|
27 | fields=[
|
---|
28 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
---|
29 | ('test', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='migration_app.Test')),
|
---|
30 | ],
|
---|
31 | ),
|
---|
32 |
|
---|
33 | # Changes type of `id` column in `testschema.migration_app_test`.
|
---|
34 | # Fails to delete old foreign key constraint `migration_app_testref_test_id_bce0807a_fk_migration_app_test_id`.
|
---|
35 | # Also adds a new constraint:
|
---|
36 | # "migration_app_testref_test_id_bce0807a_fk" FOREIGN KEY (test_id) REFERENCES migration_app_test(id) DEFERRABLE INITIALLY DEFERRED
|
---|
37 | # This leaves us with two identical constraints on this table.
|
---|
38 | migrations.AlterField(
|
---|
39 | model_name='test',
|
---|
40 | name='id',
|
---|
41 | field=models.BigAutoField(primary_key=True, serialize=False),
|
---|
42 | ),
|
---|
43 |
|
---|
44 | # Changes type of `id` column in `testschema.migration_app_test`.
|
---|
45 | # Fails to delete the two foreign key constraints.
|
---|
46 | # Fails with exception when trying to recreate the constraints:
|
---|
47 | # django.db.utils.ProgrammingError: constraint "migration_app_testref_test_id_bce0807a_fk" for relation "migration_app_testref" already exists
|
---|
48 | migrations.AlterField(
|
---|
49 | model_name='test',
|
---|
50 | name='id',
|
---|
51 | field=models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
---|
52 | ),
|
---|
53 | ]
|
---|