Add location to signal

This commit is contained in:
Eli Ribble 2026-03-19 20:49:53 +00:00
parent fdab54a775
commit c7c1c45008
No known key found for this signature in database
3 changed files with 122 additions and 9 deletions

View file

@ -0,0 +1,13 @@
-- +goose Up
DELETE FROM signal;
ALTER TABLE signal ADD COLUMN location Geometry(Geometry, 4326) NOT NULL;
ALTER TABLE signal ADD COLUMN location_type TEXT GENERATED ALWAYS AS (GeometryType(location)) STORED;
ALTER TABLE signal ADD CONSTRAINT valid_location_types
CHECK (location_type IN ('POINT', 'POLYGON', 'MULTIPOLYGON'));
CREATE INDEX idx_signal_location ON signal USING GIST(location);
CREATE INDEX idx_signal_location_type ON signal(location_type);
-- +goose Down
ALTER TABLE signal DROP INDEX idx_signal_location_type;
ALTER TABLE signal DROP INDEX idx_signal_location;
ALTER TABLE signal DROP COLUMN location_type;
ALTER TABLE signal DROP COLUMN location;