| 1 |
from unittest import mock |
| 2 |
|
| 3 |
from django.db import migrations |
| 4 |
|
| 5 |
try: |
| 6 |
from django.contrib.postgres.operations import ( |
| 7 |
BloomExtension, |
| 8 |
BtreeGinExtension, |
| 9 |
BtreeGistExtension, |
| 10 |
CITextExtension, |
| 11 |
CreateExtension, |
| 12 |
HStoreExtension, |
| 13 |
TrigramExtension, |
| 14 |
UnaccentExtension, |
| 15 |
) |
| 16 |
except ImportError: |
| 17 |
BloomExtension = mock.Mock() |
| 18 |
BtreeGinExtension = mock.Mock() |
| 19 |
BtreeGistExtension = mock.Mock() |
| 20 |
CITextExtension = mock.Mock() |
| 21 |
CreateExtension = mock.Mock() |
| 22 |
HStoreExtension = mock.Mock() |
| 23 |
TrigramExtension = mock.Mock() |
| 24 |
UnaccentExtension = mock.Mock() |
| 25 |
|
| 26 |
|
| 27 |
class Migration(migrations.Migration): |
| 28 |
operations = [ |
| 29 |
BloomExtension(), |
| 30 |
BtreeGinExtension(), |
| 31 |
BtreeGistExtension(), |
| 32 |
CITextExtension(), |
| 33 |
# Ensure CreateExtension quotes extension names by creating one with a |
| 34 |
# dash in its name. |
| 35 |
CreateExtension("uuid-ossp"), |
| 36 |
HStoreExtension(), |
| 37 |
TrigramExtension(), |
| 38 |
UnaccentExtension(), |
| 39 |
] |