-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 parent
e6ff6b7
commit ca41ca3
Showing
11 changed files
with
273 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" | ||
Postgres specific code | ||
""" | ||
|
||
try: | ||
from django.contrib.postgres.operations import CreateExtension as PGCreateExtension | ||
except ImportError: # pragma: no cover | ||
|
||
class PGCreateExtension: | ||
pass | ||
|
||
|
||
__all__ = ("PGCreateExtension",) |
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
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 |
---|---|---|
|
@@ -71,6 +71,7 @@ | |
"ipdb", | ||
"isort", | ||
"libcst", | ||
"psycopg2", | ||
"pytest-cov", | ||
"pytest-django", | ||
"restructuredtext-lint", | ||
|
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.contrib.postgres.operations import BtreeGinExtension | ||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [] | ||
|
||
operations = [ | ||
BtreeGinExtension(), | ||
] |
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,41 @@ | ||
# Generated by Django 3.2.22 on 2023-10-13 10:38 | ||
|
||
import django.contrib.postgres.indexes | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [ | ||
("app", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Message", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("score", models.IntegerField(default=0)), | ||
("unicode_name", models.CharField(db_index=True, max_length=255)), | ||
], | ||
), | ||
migrations.AddIndex( | ||
model_name="message", | ||
index=models.Index(fields=["-score"], name="message_e_score_385f90_idx"), | ||
), | ||
migrations.AddIndex( | ||
model_name="message", | ||
index=django.contrib.postgres.indexes.GinIndex( | ||
fields=["unicode_name"], name="message_e_unicode_6789fc_gin" | ||
), | ||
), | ||
] |
Empty file.
19 changes: 19 additions & 0 deletions
19
tests/app/tests/migrations/pg_indexes_custom/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,19 @@ | ||
from django.contrib.postgres.operations import BtreeGinExtension | ||
from django.db import migrations | ||
|
||
|
||
class IgnoreRollbackBtreeGinExtension(BtreeGinExtension): | ||
""" | ||
Custom extension that doesn't rollback no matter what | ||
""" | ||
|
||
def database_backwards(self, *args, **kwargs): | ||
pass | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [] | ||
|
||
operations = [ | ||
IgnoreRollbackBtreeGinExtension(), | ||
] |
41 changes: 41 additions & 0 deletions
41
tests/app/tests/migrations/pg_indexes_custom/0002_use_index.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,41 @@ | ||
# Generated by Django 3.2.22 on 2023-10-13 10:38 | ||
|
||
import django.contrib.postgres.indexes | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [ | ||
("app", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Message", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("score", models.IntegerField(default=0)), | ||
("unicode_name", models.CharField(db_index=True, max_length=255)), | ||
], | ||
), | ||
migrations.AddIndex( | ||
model_name="message", | ||
index=models.Index(fields=["-score"], name="message_e_score_385f90_idx"), | ||
), | ||
migrations.AddIndex( | ||
model_name="message", | ||
index=django.contrib.postgres.indexes.GinIndex( | ||
fields=["unicode_name"], name="message_e_unicode_6789fc_gin" | ||
), | ||
), | ||
] |
Empty file.
Oops, something went wrong.