Skip to content

Instantly share code, notes, and snippets.

@saml
Created July 16, 2019 17:51
Show Gist options
  • Save saml/c9f5f035c3125b8f45eeae3d0df2b23e to your computer and use it in GitHub Desktop.
Save saml/c9f5f035c3125b8f45eeae3d0df2b23e to your computer and use it in GitHub Desktop.
create table task(
id int primary key,
status varchar(10)
);
create table subtask(
id int primary key,
task_id int references task(id),
status varchar(10)
);
insert into task values (1, 'ready');
insert into subtask values (1, 1, 'ready');
insert into subtask values (2, 1, 'ready');
insert into subtask values (3, 1, 'processing');
-- when all subtasks are ready, I want task to be ready
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment