feat: Districts table and geojson stub

This commit is contained in:
2026-06-30 23:29:31 +05:00
parent f364ce4c6e
commit 0b45636e5b
5 changed files with 121 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
-- +goose Up
-- Administrative districts, keyed by KATO code. Geometry is the district
-- boundary stored as MultiPolygon in EPSG:4326. Populated from a districts
-- GeoJSON file via the `gis import-districts` subcommand.
CREATE TABLE districts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
kato TEXT NOT NULL,
name TEXT NOT NULL,
coordinates geometry(MultiPolygon, 4326) NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE UNIQUE INDEX uq_districts_kato ON districts (kato);
CREATE INDEX idx_districts_coordinates ON districts USING GIST (coordinates);
-- +goose Down
DROP TABLE districts;