add on delete contraints to schema
This commit is contained in:
parent
8c66fe69de
commit
2d45fe666b
|
@ -10,7 +10,7 @@ create table node(id integer primary key, name text not null, arch text not null
|
|||
-- @up {
|
||||
create table node_resource(nodeid integer not null, resource text not null,
|
||||
unique (nodeid, resource),
|
||||
foreign key(nodeid) references node(id));
|
||||
foreign key(nodeid) references node(id) on delete cascade);
|
||||
-- }
|
||||
-- @up {
|
||||
create table task(id integer primary key, name text not null, manifest blob not null,
|
||||
|
@ -21,12 +21,12 @@ create table task_log(taskid integer not null, worker integer not null,
|
|||
time_start timestamp not null,
|
||||
time_end timestamp check(time_end >= time_start) not null,
|
||||
pattern blob not null,
|
||||
foreign key (taskid) references tasks(id),
|
||||
foreign key (worker) references node(id));
|
||||
foreign key (taskid) references tasks(id) on delete cascade,
|
||||
foreign key (worker) references node(id) on delete restrict);
|
||||
-- }
|
||||
-- @up {
|
||||
create table task_match(taskid integer not null, time timestamp not null, match blob not null,
|
||||
foreign key (taskid) references tasks(id));
|
||||
foreign key (taskid) references tasks(id) on delete cascade);
|
||||
-- }
|
||||
|
||||
-- @down {
|
||||
|
|
Loading…
Reference in New Issue