Пример #1
0
 def test_create_existing_extension(self):
     operation = BloomExtension()
     project_state = ProjectState()
     new_state = project_state.clone()
     # Don't create an existing extension.
     with CaptureQueriesContext(connection) as captured_queries:
         with connection.schema_editor(atomic=False) as editor:
             operation.database_forwards(self.app_label, editor,
                                         project_state, new_state)
     self.assertEqual(len(captured_queries), 3)
     self.assertIn('SELECT', captured_queries[0]['sql'])
Пример #2
0
class Migration(migrations.Migration):

    operations = [
        BloomExtension(),
        BtreeGinExtension(),
        BtreeGistExtension(),
        CITextExtension(),
        # Ensure CreateExtension quotes extension names by creating one with a
        # dash in its name.
        CreateExtension('uuid-ossp'),
        CryptoExtension(),
        HStoreExtension(),
        TrigramExtension(),
        UnaccentExtension(),
    ]
Пример #3
0
class Migration(migrations.Migration):

    operations = [
        BloomExtension(),
        BtreeGinExtension(),
        BtreeGistExtension(),
        CITextExtension(),
        # Ensure CreateExtension quotes extension names by creating one with a
        # dash in its name.
        CreateExtension("uuid-ossp"),
        # CryptoExtension is required for RandomUUID() on PostgreSQL < 13.
        CryptoExtension() if needs_crypto_extension else mock.Mock(),
        HStoreExtension(),
        TrigramExtension(),
        UnaccentExtension(),
    ]
Пример #4
0
class Migration(migrations.Migration):

    operations = [
        (BloomExtension() if getattr(connection.features, 'has_bloom_index',
                                     False) else mock.Mock()),
        BtreeGinExtension(),
        BtreeGistExtension(),
        CITextExtension(),
        # Ensure CreateExtension quotes extension names by creating one with a
        # dash in its name.
        CreateExtension('uuid-ossp'),
        CryptoExtension(),
        HStoreExtension(),
        TrigramExtension(),
        UnaccentExtension(),
    ]