Loading django/contrib/postgres/operations.py +2 −2 Original line number Diff line number Diff line Loading @@ -14,10 +14,10 @@ class CreateExtension(Operation): def database_forwards(self, app_label, schema_editor, from_state, to_state): if schema_editor.connection.vendor != 'postgresql': return schema_editor.execute("CREATE EXTENSION IF NOT EXISTS %s" % self.name) schema_editor.execute("CREATE EXTENSION IF NOT EXISTS %s" % schema_editor.quote_name(self.name)) def database_backwards(self, app_label, schema_editor, from_state, to_state): schema_editor.execute("DROP EXTENSION %s" % self.name) schema_editor.execute("DROP EXTENSION %s" % schema_editor.quote_name(self.name)) def describe(self): return "Creates extension %s" % self.name Loading tests/postgres_tests/migrations/0001_setup_extensions.py +5 −4 Original line number Diff line number Diff line Loading @@ -5,20 +5,21 @@ from django.db import migrations try: from django.contrib.postgres.operations import ( HStoreExtension, UnaccentExtension, CreateExtension, HStoreExtension, UnaccentExtension, ) except ImportError: from django.test import mock CreateExtension = mock.Mock() HStoreExtension = mock.Mock() UnaccentExtension = mock.Mock() class Migration(migrations.Migration): dependencies = [ ] operations = [ # Ensure CreateExtension quotes extension names by creating one with a # dash in its name. CreateExtension('uuid-ossp'), HStoreExtension(), UnaccentExtension(), ] Loading
django/contrib/postgres/operations.py +2 −2 Original line number Diff line number Diff line Loading @@ -14,10 +14,10 @@ class CreateExtension(Operation): def database_forwards(self, app_label, schema_editor, from_state, to_state): if schema_editor.connection.vendor != 'postgresql': return schema_editor.execute("CREATE EXTENSION IF NOT EXISTS %s" % self.name) schema_editor.execute("CREATE EXTENSION IF NOT EXISTS %s" % schema_editor.quote_name(self.name)) def database_backwards(self, app_label, schema_editor, from_state, to_state): schema_editor.execute("DROP EXTENSION %s" % self.name) schema_editor.execute("DROP EXTENSION %s" % schema_editor.quote_name(self.name)) def describe(self): return "Creates extension %s" % self.name Loading
tests/postgres_tests/migrations/0001_setup_extensions.py +5 −4 Original line number Diff line number Diff line Loading @@ -5,20 +5,21 @@ from django.db import migrations try: from django.contrib.postgres.operations import ( HStoreExtension, UnaccentExtension, CreateExtension, HStoreExtension, UnaccentExtension, ) except ImportError: from django.test import mock CreateExtension = mock.Mock() HStoreExtension = mock.Mock() UnaccentExtension = mock.Mock() class Migration(migrations.Migration): dependencies = [ ] operations = [ # Ensure CreateExtension quotes extension names by creating one with a # dash in its name. CreateExtension('uuid-ossp'), HStoreExtension(), UnaccentExtension(), ]