Skip to content

Commit

Permalink
Fix issue with a user creating a database without PostGIS extension
Browse files Browse the repository at this point in the history
  • Loading branch information
NyakudyaA committed Jan 9, 2018
1 parent f407ba2 commit 78a62c9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions PyQt4Dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def test_database_schema(self):
"""Test whether co-go schema is applied in the database."""
query = "SELECT EXISTS (SELECT 1 AS result FROM pg_tables " \
"WHERE schemaname = 'public' AND tablename = 'beacons')"
extension_query = '''CREATE EXTENSION IF NOT EXISTS postgis ; '''

settings_postgis = QSettings()
settings_postgis.beginGroup('PostgreSQL/connections')
Expand Down Expand Up @@ -292,6 +293,7 @@ def test_database_schema(self):

if self.db_connection:
cursor = self.db_connection.cursor()
cursor.execute(extension_query)
cursor.execute(query)
is_schema_valid = cursor.fetchall()[0][0]
del cursor
Expand Down

0 comments on commit 78a62c9

Please sign in to comment.