]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/tools/migration.py
add extra column for tokenizer
[nominatim.git] / nominatim / tools / migration.py
index 80539702c25332bdb04d7f0cf31524a7846fb32a..c8011eeb242da2e5beff8a9028727e1997a7cbb6 100644 (file)
@@ -175,6 +175,14 @@ def install_legacy_tokenizer(conn, config, **_):
         configuration for the backwards-compatible legacy tokenizer
     """
     if properties.get_property(conn, 'tokenizer') is None:
+        with conn.cursor() as cur:
+            for table in ('placex', 'location_property_osmline'):
+                has_column = cur.scalar("""SELECT count(*) FROM information_schema.columns
+                                           WHERE table_name = %s
+                                           and column_name = 'token_info'""",
+                                        (table, ))
+            if has_column == 0:
+                cur.execute('ALTER TABLE {} ADD COLUMN token_info JSONB'.format(table))
         tokenizer = tokenizer_factory.create_tokenizer(config, init_db=False,
                                                        module_name='legacy')