pass reverse-only as a separate parameter

... instead of hacking the internal structures of SQLPreprocessor
This commit is contained in:
Sarah Hoffmann
2026-02-12 10:56:52 +01:00
parent 5314e6c881
commit 70b9140f13
2 changed files with 5 additions and 6 deletions

View File

@@ -7,7 +7,7 @@
DROP TABLE IF EXISTS search_name; DROP TABLE IF EXISTS search_name;
{% if not db.reverse_only %} {% if not create_reverse_only %}
CREATE TABLE search_name ( CREATE TABLE search_name (
place_id BIGINT NOT NULL, place_id BIGINT NOT NULL,

View File

@@ -152,12 +152,11 @@ def create_tables(conn: Connection, config: Configuration, reverse_only: bool =
When `reverse_only` is True, then the main table for searching will When `reverse_only` is True, then the main table for searching will
be skipped and only reverse search is possible. be skipped and only reverse search is possible.
""" """
sql = SQLPreprocessor(conn, config) SQLPreprocessor(conn, config).run_sql_file(conn, 'tables.sql',
sql.env.globals['db']['reverse_only'] = reverse_only create_reverse_only=reverse_only)
sql.run_sql_file(conn, 'tables.sql') # reinitiate the preprocessor to get all the newly created tables
SQLPreprocessor(conn, config).run_sql_file(conn, 'grants.sql')
sql.run_sql_file(conn, 'grants.sql')
def create_table_triggers(conn: Connection, config: Configuration) -> None: def create_table_triggers(conn: Connection, config: Configuration) -> None: