https://prefect.io logo
Title
j

José Duarte

10/12/2022, 4:45 PM
Hey all, I think there are two FKs missing in the “flow run” family The
flow_run_notification_queue
has both
flow_run_state_id
and
flow_run_notification_policy_id
but doesn’t connect with either table. Example:
sqlite> .schema flow_run_notification_queue
CREATE TABLE IF NOT EXISTS "flow_run_notification_queue" (
	id CHAR(36) DEFAULT ((
        lower(hex(randomblob(4)))
        || '-'
        || lower(hex(randomblob(2)))
        || '-4'
        || substr(lower(hex(randomblob(2))),2)
        || '-'
        || substr('89ab',abs(random()) % 4 + 1, 1)
        || substr(lower(hex(randomblob(2))),2)
        || '-'
        || lower(hex(randomblob(6)))
    )) NOT NULL,
	created DATETIME DEFAULT (strftime('%Y-%m-%d %H:%M:%f000', 'now')) NOT NULL,
	updated DATETIME DEFAULT (strftime('%Y-%m-%d %H:%M:%f000', 'now')) NOT NULL,
	flow_run_notification_policy_id CHAR(36) NOT NULL,
	flow_run_state_id CHAR(36) NOT NULL,
	CONSTRAINT pk_flow_run_notification_queue PRIMARY KEY (id)
);
CREATE INDEX ix_flow_run_notification_queue__updated ON flow_run_notification_queue (updated);
Along with
CONSTRAINT pk_flow_run_notification_queue PRIMARY KEY (id)
there should be something like
CONSTRAINT fk_flow_run_notification_queue__flow_state_id__flow_state FOREIGN KEY(flow_state_id) REFERENCES flow_run (id) ON DELETE cascade
as there is on other tables. Although I am probably missing something, could anyone from the Prefect team take a look?