feat: Add SLD endpoints, add date_to to vector_with_kato
This commit is contained in:
15
migrations/00009_add_period_to_dataset_observations.sql
Normal file
15
migrations/00009_add_period_to_dataset_observations.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
-- +goose Up
|
||||
-- Optional period end date, so a year_column mapping can represent a date
|
||||
-- range (date..date_to) instead of a single point in time. NULL preserves the
|
||||
-- pre-existing point-in-time behavior; the unique index treats a NULL date_to
|
||||
-- as equal to date itself so point observations keep deduplicating exactly as
|
||||
-- before.
|
||||
ALTER TABLE dataset_observations ADD COLUMN date_to DATE;
|
||||
|
||||
DROP INDEX uq_dataset_observations;
|
||||
CREATE UNIQUE INDEX uq_dataset_observations ON dataset_observations (dataset_id, kato_code, date, COALESCE(date_to, date));
|
||||
|
||||
-- +goose Down
|
||||
DROP INDEX uq_dataset_observations;
|
||||
ALTER TABLE dataset_observations DROP COLUMN date_to;
|
||||
CREATE UNIQUE INDEX uq_dataset_observations ON dataset_observations (dataset_id, kato_code, date);
|
||||
Reference in New Issue
Block a user