Compare commits

...

2 Commits

Author SHA1 Message Date
Sarah Hoffmann
194b607491 Merge pull request #3797 from mtmail/database-version-not-found
Better hint to user if database import didnt finish
2025-07-30 12:08:10 +02:00
marc tobias
9bad3b1e61 Better hint to user if database import didnt finish 2025-07-30 10:25:14 +02:00
3 changed files with 21 additions and 20 deletions

View File

@@ -92,7 +92,7 @@ but executes against the code in the source tree. For example:
```
me@machine:~$ cd Nominatim
me@machine:~Nominatim$ ./nominatim-cli.py --version
Nominatim version 4.4.99-1
Nominatim version 5.1.0-0
```
Make sure you have activated the virtual environment holding all

View File

@@ -2,7 +2,7 @@
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2024 by the Nominatim developer community.
# Copyright (C) 2025 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Collection of functions that check if the database is complete and functional.
@@ -163,12 +163,8 @@ def check_connection(conn: Any, config: Configuration) -> CheckResult:
Database version ({db_version}) doesn't match Nominatim version ({nom_version})
Hints:
* Are you connecting to the correct database?
{instruction}
Check the Migration chapter of the Administration Guide.
Project directory: {config.project_dir}
Current setting of NOMINATIM_DATABASE_DSN: {config.DATABASE_DSN}
""")
@@ -176,24 +172,25 @@ def check_database_version(conn: Connection, config: Configuration) -> CheckResu
""" Checking database_version matches Nominatim software version
"""
if table_exists(conn, 'nominatim_properties'):
db_version_str = properties.get_property(conn, 'database_version')
else:
db_version_str = None
if not table_exists(conn, 'nominatim_properties'):
instruction = 'Are you connecting to the correct database?'
else:
db_version_str = properties.get_property(conn, 'database_version')
if db_version_str is not None:
if db_version_str is None:
instruction = 'Database version not found. Did the import finish?'
else:
db_version = parse_version(db_version_str)
if db_version == NOMINATIM_VERSION:
return CheckState.OK
instruction = (
'Run migrations: nominatim admin --migrate'
"Run migrations: 'nominatim admin --migrate'"
if db_version < NOMINATIM_VERSION
else 'You need to upgrade the Nominatim software.'
)
else:
instruction = ''
) + ' Check the Migration chapter of the Administration Guide.'
return CheckState.FATAL, dict(db_version=db_version_str,
nom_version=NOMINATIM_VERSION,

View File

@@ -31,6 +31,10 @@ def test_check_connection_bad(def_config):
assert chkdb.check_connection(badconn, def_config) == chkdb.CheckState.FATAL
def test_check_database_version_not_found(property_table, temp_db_conn, def_config):
assert chkdb.check_database_version(temp_db_conn, def_config) == chkdb.CheckState.FATAL
def test_check_database_version_good(property_table, temp_db_conn, def_config):
property_table.set('database_version',
str(nominatim_db.version.NOMINATIM_VERSION))