From df44a7c0de9fcb2f9909a74f69ef8f296826a516 Mon Sep 17 00:00:00 2001 From: adam Date: Sat, 13 Feb 2021 16:59:20 +0200 Subject: i think i broke something --- sql/fileshare.sql | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'sql/fileshare.sql') diff --git a/sql/fileshare.sql b/sql/fileshare.sql index b0c28a5..7dae888 100644 --- a/sql/fileshare.sql +++ b/sql/fileshare.sql @@ -3,7 +3,10 @@ drop table if exists node_access; drop table if exists users; drop table if exists node_links; drop table if exists trash; +drop table if exists super_trash; drop trigger if exists delete_on_zero_links; +drop trigger if exists delete_links; +drop trigger if exists del_node; drop table if exists nodes; @@ -50,8 +53,12 @@ create table node_links ( create table trash ( node_id int not null, - foreign key (node_id) references nodes(node_id) on delete cascade + foreign key (node_id) references nodes(node_id) ); +create table super_trash ( + node_id int not null, + foreign key (node_id) references nodes(node_id) + ); create trigger delete_on_zero_links @@ -61,12 +68,17 @@ create trigger delete_on_zero_links insert into trash select nodes.node_id from nodes - where nodes.node_id not in (select node_id from node_links) and nodes.node_id=old.node_id; + where nodes.node_id not in (select node_id from node_links) and nodes.node_id=old.node_id ; - /* create trigger delete_links after delete on nodes for each row - delete from + delete from node_links where directory_id=old.node_id; +/* +create trigger del_node + after insert + on trash + for each row + delete from nodes where node_id=new.node_id; */ -- cgit v1.2.3