feat: Districts table and geojson stub
This commit is contained in:
17
migrations/00006_create_districts_table.sql
Normal file
17
migrations/00006_create_districts_table.sql
Normal 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;
|
||||
Reference in New Issue
Block a user