City-portal/db/init.sql
Zeph Levy c6dd6abaf1 Implement basic city portal logic (and severely deabstract)
- Create a podman compose for Postgres
- Implement types and tables for urban data
- No longer use a Cargo workspace as there's no point currently
- Create query functionality (not mutation yet)
2025-11-28 22:45:42 +01:00

20 lines
490 B
SQL

CREATE TABLE datasets (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
description TEXT
);
CREATE TABLE locations (
id SERIAL PRIMARY KEY,
name TEXT,
lat DOUBLE PRECISION NOT NULL,
lon DOUBLE PRECISION NOT NULL
);
CREATE TABLE records (
id SERIAL PRIMARY KEY,
dataset_id INTEGER NOT NULL REFERENCES datasets(id),
location_id INTEGER REFERENCES locations(id),
timestamp TIMESTAMPTZ NOT NULL,
data JSONB
);