mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #28975 -- Made PostGIS backend skip extension creation if installed.
This commit is contained in:
@@ -23,4 +23,7 @@ class DatabaseWrapper(Psycopg2DatabaseWrapper):
|
||||
super().prepare_database()
|
||||
# Check that postgis extension is installed.
|
||||
with self.cursor() as cursor:
|
||||
cursor.execute("SELECT 1 FROM pg_extension WHERE extname = %s", ["postgis"])
|
||||
if bool(cursor.fetchone()):
|
||||
return
|
||||
cursor.execute("CREATE EXTENSION IF NOT EXISTS postgis")
|
||||
|
||||
Reference in New Issue
Block a user