-- Temporary per-feature delivery. Does not publish an official Eddy baseline. CREATE TABLE IF NOT EXISTS eddy_feature_exports ( id text PRIMARY KEY, feature_id text NOT NULL REFERENCES features(id) ON DELETE CASCADE, node_id text NOT NULL, commit_sha text NOT NULL, branch text NOT NULL, recipe_hash text NOT NULL, spec text NOT NULL, phase text NOT NULL DEFAULT 'queued', lease text, lease_until bigint, created_at bigint NOT NULL, updated_at bigint NOT NULL, expires_at bigint, error text, result text ); CREATE INDEX IF NOT EXISTS eddy_exports_feature ON eddy_feature_exports(feature_id, created_at DESC); CREATE INDEX IF NOT EXISTS eddy_exports_queue ON eddy_feature_exports(node_id, phase, created_at); CREATE TABLE IF NOT EXISTS eddy_export_notifications ( export_id text NOT NULL REFERENCES eddy_feature_exports(id) ON DELETE CASCADE, email text NOT NULL, sent_at bigint, next_attempt_at bigint NOT NULL DEFAULT 0, PRIMARY KEY (export_id, email) );