-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
2,267 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
362 changes: 306 additions & 56 deletions
362
django_zero_downtime_migrations/backends/postgres/schema.py
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
42 changes: 42 additions & 0 deletions
42
tests/apps/idempotency_add_check_app/migrations/0001_initial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="RelatedTestTable", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("test_field_int", models.IntegerField(null=True)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name="TestTable", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("test_field_int", models.IntegerField()), | ||
("test_field_str", models.CharField(max_length=10)), | ||
], | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
..._app/migrations/0002_relatedtesttable_idempotency_add_check_app_relatedtesttable_check.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
atomic = False | ||
|
||
dependencies = [ | ||
("idempotency_add_check_app", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddConstraint( | ||
model_name="relatedtesttable", | ||
constraint=models.CheckConstraint( | ||
check=models.Q(("test_field_int__gt", 0)), | ||
name="idempotency_add_check_app_relatedtesttable_check", | ||
), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from django.db import models | ||
|
||
|
||
class TestTable(models.Model): | ||
test_field_int = models.IntegerField() | ||
test_field_str = models.CharField(max_length=10) | ||
|
||
|
||
class RelatedTestTable(models.Model): | ||
test_field_int = models.IntegerField(null=True) | ||
|
||
class Meta: | ||
constraints = [ | ||
models.CheckConstraint( | ||
check=models.Q(test_field_int__gt=0), | ||
name="idempotency_add_check_app_relatedtesttable_check", | ||
) | ||
] |
Empty file.
42 changes: 42 additions & 0 deletions
42
tests/apps/idempotency_add_column_app/migrations/0001_initial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="RelatedTestTable", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("test_field_int", models.IntegerField(null=True)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name="TestTable", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("test_field_int", models.IntegerField()), | ||
("test_field_str", models.CharField(max_length=10)), | ||
], | ||
), | ||
] |
25 changes: 25 additions & 0 deletions
25
tests/apps/idempotency_add_column_app/migrations/0002_relatedtesttable_test_model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 5.0 on 2024-04-22 17:47 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
atomic = False | ||
|
||
dependencies = [ | ||
("idempotency_add_column_app", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="relatedtesttable", | ||
name="test_model", | ||
field=models.OneToOneField( | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="idempotency_add_column_app.testtable", | ||
), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django.db import models | ||
|
||
|
||
class TestTable(models.Model): | ||
test_field_int = models.IntegerField() | ||
test_field_str = models.CharField(max_length=10) | ||
|
||
|
||
class RelatedTestTable(models.Model): | ||
test_field_int = models.IntegerField(null=True) | ||
test_model = models.OneToOneField(TestTable, null=True, on_delete=models.CASCADE) |
Empty file.
42 changes: 42 additions & 0 deletions
42
tests/apps/idempotency_add_foreign_key_app/migrations/0001_initial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="RelatedTestTable", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("test_field_int", models.IntegerField(null=True)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name="TestTable", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("test_field_int", models.IntegerField()), | ||
("test_field_str", models.CharField(max_length=10)), | ||
], | ||
), | ||
] |
24 changes: 24 additions & 0 deletions
24
.../idempotency_add_foreign_key_app/migrations/0002_alter_relatedtesttable_test_field_int.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
atomic = False | ||
|
||
dependencies = [ | ||
("idempotency_add_foreign_key_app", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="relatedtesttable", | ||
name="test_field_int", | ||
field=models.ForeignKey( | ||
db_column="test_field_int", | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="idempotency_add_foreign_key_app.testtable", | ||
), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from django.db import models | ||
|
||
|
||
class TestTable(models.Model): | ||
test_field_int = models.IntegerField() | ||
test_field_str = models.CharField(max_length=10) | ||
|
||
|
||
class RelatedTestTable(models.Model): | ||
test_field_int = models.ForeignKey( | ||
TestTable, | ||
null=True, | ||
on_delete=models.CASCADE, | ||
db_column="test_field_int", | ||
) |
Empty file.
42 changes: 42 additions & 0 deletions
42
tests/apps/idempotency_add_index_app/migrations/0001_initial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="RelatedTestTable", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("test_field_int", models.IntegerField(null=True)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name="TestTable", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("test_field_int", models.IntegerField()), | ||
("test_field_str", models.CharField(max_length=10)), | ||
], | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
...s/apps/idempotency_add_index_app/migrations/0002_alter_relatedtesttable_test_field_int.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
atomic = False | ||
|
||
dependencies = [ | ||
("idempotency_add_index_app", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="relatedtesttable", | ||
name="test_field_int", | ||
field=models.IntegerField(db_index=True, null=True), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django.db import models | ||
|
||
|
||
class TestTable(models.Model): | ||
test_field_int = models.IntegerField() | ||
test_field_str = models.CharField(max_length=10) | ||
|
||
|
||
class RelatedTestTable(models.Model): | ||
test_field_int = models.IntegerField(null=True, db_index=True) |
Empty file.
43 changes: 43 additions & 0 deletions
43
tests/apps/idempotency_add_index_meta_app/migrations/0001_initial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="RelatedTestTable", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("test_field_int", models.IntegerField()), | ||
("test_field_str", models.CharField(max_length=10)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name="TestTable", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("test_field_int", models.IntegerField()), | ||
("test_field_str", models.CharField(max_length=10)), | ||
], | ||
), | ||
] |
Oops, something went wrong.