aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradam <adam@>2021-02-13 15:40:53 +0200
committeradam <adam@>2021-02-13 15:40:53 +0200
commit0abc4c6de856c5c1d678d82bb464758c934fae0c (patch)
treea23899cd5cdb8cb46d88d47b719d7c4f133c839c
parent25923c67bcf8c404174acca72fc888c42ff13e57 (diff)
downloadfileup-0abc4c6de856c5c1d678d82bb464758c934fae0c.tar.gz
triggers are kinda ok
-rw-r--r--sql/fileshare.sql21
1 files changed, 12 insertions, 9 deletions
diff --git a/sql/fileshare.sql b/sql/fileshare.sql
index 4eb60f7..b0c28a5 100644
--- a/sql/fileshare.sql
+++ b/sql/fileshare.sql
@@ -54,16 +54,19 @@ create table trash (
);
-/*
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
- );
+ for each row
+ 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;
-*/
+ /*
+create trigger delete_links
+ after delete
+ on nodes
+ for each row
+ delete from
+ */