mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
Added version check for PostGis and Postgres
This commit is contained in:
committed by
Sarah Hoffmann
parent
b4e3d0ea44
commit
8e71ff329c
@@ -99,6 +99,8 @@ class SetupAll:
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
if not args.prepare_database or args.no_superuser or complete_import:
|
if not args.prepare_database or args.no_superuser or complete_import:
|
||||||
|
# Check if the correct plugins are installed
|
||||||
|
database_import.check_existing_database_plugins(args.config.get_libpq_dsn())
|
||||||
LOG.warning('Setting up country tables')
|
LOG.warning('Setting up country tables')
|
||||||
country_info.setup_country_tables(args.config.get_libpq_dsn(),
|
country_info.setup_country_tables(args.config.get_libpq_dsn(),
|
||||||
args.config.lib_dir.data,
|
args.config.lib_dir.data,
|
||||||
|
|||||||
@@ -38,6 +38,16 @@ def _require_version(module: str, actual: Tuple[int, int], expected: Tuple[int,
|
|||||||
raise UsageError(f'{module} is too old.')
|
raise UsageError(f'{module} is too old.')
|
||||||
|
|
||||||
|
|
||||||
|
def check_existing_database_plugins(dsn: str):
|
||||||
|
with connect(dsn) as conn:
|
||||||
|
_require_version('PostgreSQL server',
|
||||||
|
conn.server_version_tuple(),
|
||||||
|
POSTGRESQL_REQUIRED_VERSION)
|
||||||
|
_require_version('PostGIS',
|
||||||
|
conn.postgis_version_tuple(),
|
||||||
|
POSTGIS_REQUIRED_VERSION)
|
||||||
|
|
||||||
|
|
||||||
def setup_database_skeleton(dsn: str, rouser: Optional[str] = None) -> None:
|
def setup_database_skeleton(dsn: str, rouser: Optional[str] = None) -> None:
|
||||||
""" Create a new database for Nominatim and populate it with the
|
""" Create a new database for Nominatim and populate it with the
|
||||||
essential extensions.
|
essential extensions.
|
||||||
|
|||||||
Reference in New Issue
Block a user