summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2020-06-02 23:18:15 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-06-03 07:02:48 +0200
commit22a59c01c00cf9fbefaee0e8e67fab82bbaf1fd2 (patch)
tree03d01a775b5535fda32831dbf83ae25a4dfbc902 /django
parent06c8565a4650b359bdfa59f9707eaa0d1dfd7223 (diff)
Refs #31615 -- Added EXISTS clauses to extension operations.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/postgres/operations.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/contrib/postgres/operations.py b/django/contrib/postgres/operations.py
index b25438b826..7c28bc48ce 100644
--- a/django/contrib/postgres/operations.py
+++ b/django/contrib/postgres/operations.py
@@ -23,7 +23,7 @@ class CreateExtension(Operation):
return
if not self.extension_exists(schema_editor, self.name):
schema_editor.execute(
- 'CREATE EXTENSION %s' % schema_editor.quote_name(self.name)
+ 'CREATE EXTENSION IF NOT EXISTS %s' % schema_editor.quote_name(self.name)
)
# Clear cached, stale oids.
get_hstore_oids.cache_clear()
@@ -38,7 +38,7 @@ class CreateExtension(Operation):
return
if self.extension_exists(schema_editor, self.name):
schema_editor.execute(
- 'DROP EXTENSION %s' % schema_editor.quote_name(self.name)
+ 'DROP EXTENSION IF EXISTS %s' % schema_editor.quote_name(self.name)
)
# Clear cached, stale oids.
get_hstore_oids.cache_clear()