From 3df488f67444378ec73278e89505534cd8eb88fa Mon Sep 17 00:00:00 2001 From: gvsyn Date: Wed, 18 Jun 2025 22:25:58 +0200 Subject: [PATCH] Fix up table creation The column count between the CSV and the tables did not match. The enum is an aggregate of all the modes, which is good enough for getting things working. --- create_tables.sql | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/create_tables.sql b/create_tables.sql index 87f55f5..f832107 100644 --- a/create_tables.sql +++ b/create_tables.sql @@ -1,5 +1,9 @@ DROP TABLE IF EXISTS edges; DROP TABLE IF EXISTS nodes; +DROP TYPE IF EXISTS accessibility; + +-- Could be seperated into multiple enum types, this was a quick enough fix +CREATE TYPE accessibility AS ENUM ('Unknown', 'Forbidden', 'Allowed', 'Residential', 'Tertiary', 'Secondary', 'Primary', 'Trunk', 'Motorway', 'Lane', 'Busway', 'Track'); CREATE TABLE nodes ( id BIGINT PRIMARY KEY, @@ -7,16 +11,20 @@ CREATE TABLE nodes ( latitude DOUBLE PRECISION ); +--id,osm_id,source,target,length,foot,car_forward,car_backward,bike_forward,bike_backward,train,wkt + CREATE TABLE edges ( - id BIGINT, + id TEXT, + osm_id BIGINT, source BIGINT REFERENCES nodes(id), target BIGINT REFERENCES nodes(id), length REAL, - foot INT, - car_forward INT, - car_backward INT, - bike_forward INT, - bike_backward INT, + foot accessibility, + car_forward accessibility, + car_backward accessibility, + bike_forward accessibility, + bike_backward accessibility, + train accessibility, wkt TEXT );