nidus-sync/db/migrations/00124_signal_publicreport_pool.sql
Eli Ribble 9b6cacda0e
Make signals include the object they are attached to (pool, report)
This means pushing the types into the common types module, which
required a refactor of a bunch of other libraries.
2026-03-21 01:19:36 +00:00

12 lines
503 B
SQL

-- +goose Up
ALTER TABLE signal ADD COLUMN feature_pool_feature_id INTEGER REFERENCES feature_pool(feature_id);
ALTER TABLE signal ADD COLUMN report_id INTEGER REFERENCES publicreport.report(id);
ALTER TABLE signal
ADD CONSTRAINT check_exclusive_reference
CHECK (
(feature_pool_feature_id IS NULL OR report_id IS NULL)
);
-- +goose Down
ALTER TABLE signal DROP CONSTRAINT check_exclusive_reference;
ALTER TABLE signal DROP COLUMN report_id;
ALTER TABLE signal DROP COLUMN feature_pool_feature_id;