Skip to content

Instantly share code, notes, and snippets.

@carld
Created July 13, 2015 01:31
Show Gist options
  • Save carld/5a47a9cbc9dfc6351cac to your computer and use it in GitHub Desktop.
Save carld/5a47a9cbc9dfc6351cac to your computer and use it in GitHub Desktop.
-- reference Karwin
drop table closure;
drop table nodes;
create table nodes (
node serial primary key,
label varchar(32) not null
);
create table closure (
ancestor int not null,
descendant int not null,
primary key (ancestor, descendant),
foreign key (ancestor) references nodes(node) on delete cascade,
foreign key (descendant) references nodes(node)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment