diff options
author | adam <adam@> | 2021-02-13 14:51:35 +0200 |
---|---|---|
committer | adam <adam@> | 2021-02-13 14:51:35 +0200 |
commit | a346874ea858d43ee2336e315dba056fb81b6439 (patch) | |
tree | 0200c71d16cc345daff1bd5988552400f205fcd2 /sql/fileshare.sql | |
parent | 8b1393b3f06fdd86abc3dca396670965c42ba8c2 (diff) | |
download | fileup-a346874ea858d43ee2336e315dba056fb81b6439.tar.gz |
nothing done
Diffstat (limited to 'sql/fileshare.sql')
-rw-r--r-- | sql/fileshare.sql | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sql/fileshare.sql b/sql/fileshare.sql index 8e69881..4eb60f7 100644 --- a/sql/fileshare.sql +++ b/sql/fileshare.sql @@ -2,6 +2,8 @@ drop table if exists node_access; drop table if exists users; drop table if exists node_links; +drop table if exists trash; +drop trigger if exists delete_on_zero_links; drop table if exists nodes; @@ -42,9 +44,26 @@ create table node_links ( node_id int not null, name varchar(100) not null default 'no name', note varchar(200) not null default "", - check (directory_id != node_id), foreign key (directory_id) references nodes(node_id) on delete cascade, foreign key (node_id) references nodes(node_id) on delete cascade ); +create table trash ( + node_id int not null, + foreign key (node_id) references nodes(node_id) on delete cascade +); + +/* +create trigger delete_on_zero_links + after delete + on node_links + for each row + insert into trash(node_id) + select + if(old.node_id not in (select node_id from node_links), + old.node_id, + select node_id from nodes where 1=0 + ); + +*/ |