mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
Store entrance fields as columns on table
This commit is contained in:
@@ -119,24 +119,27 @@ def create_postcode_parent_index(conn: Connection, **_: Any) -> None:
|
||||
|
||||
|
||||
@_migration(5, 1, 99, 0)
|
||||
def create_place_entrance_table(conn: Connection, config: Configuration, **_: Any) -> None:
|
||||
""" Add the place_entrance table to store entrance nodes
|
||||
def create_placex_entrance_table(conn: Connection, config: Configuration, **_: Any) -> None:
|
||||
""" Add the placex_entrance table to store entrance nodes
|
||||
"""
|
||||
sqlp = SQLPreprocessor(conn, config)
|
||||
sqlp.run_string(conn, """
|
||||
-- Table to store location of entrance nodes
|
||||
DROP TABLE IF EXISTS place_entrance;
|
||||
CREATE TABLE place_entrance (
|
||||
DROP TABLE IF EXISTS placex_entrance;
|
||||
CREATE TABLE placex_entrance (
|
||||
place_id BIGINT NOT NULL,
|
||||
entrances JSONB NOT NULL
|
||||
osm_id BIGINT NOT NULL,
|
||||
type TEXT NOT NULL,
|
||||
location GEOMETRY(Point, 4326) NOT NULL,
|
||||
extratags HSTORE
|
||||
);
|
||||
CREATE UNIQUE INDEX idx_place_entrance_place_id ON place_entrance
|
||||
USING BTREE (place_id) {{db.tablespace.search_index}};
|
||||
GRANT SELECT ON place_entrance TO "{{config.DATABASE_WEBUSER}}" ;
|
||||
CREATE UNIQUE INDEX idx_placex_entrance_place_id_osm_id ON placex_entrance
|
||||
USING BTREE (place_id, osm_id) {{db.tablespace.search_index}};
|
||||
GRANT SELECT ON placex_entrance TO "{{config.DATABASE_WEBUSER}}" ;
|
||||
|
||||
-- Create an index on the place table for lookups to populate the entrance
|
||||
-- table
|
||||
CREATE INDEX IF NOT EXISTS idx_place_entrance_lookup ON place
|
||||
CREATE INDEX IF NOT EXISTS idx_placex_entrance_lookup ON place
|
||||
USING BTREE (osm_id)
|
||||
WHERE class IN ('routing:entrance', 'entrance');
|
||||
""")
|
||||
|
||||
Reference in New Issue
Block a user