diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-06-03 13:10:50 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:20 +0100 |
commit | 25e62472339c75b8672a5390f2dc8f098f736f1e (patch) | |
tree | abe0a633f9267cdb0bedfca0f581c4622880e30f /archaeological_warehouse/models.py | |
parent | 0373c928fb20be6bebde7ab55ba0953a70d0adde (diff) | |
download | Ishtar-25e62472339c75b8672a5390f2dc8f098f736f1e.tar.bz2 Ishtar-25e62472339c75b8672a5390f2dc8f098f736f1e.zip |
Container trees: UPDATE rules
Diffstat (limited to 'archaeological_warehouse/models.py')
-rw-r--r-- | archaeological_warehouse/models.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 951830d95..2df5cbe77 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -451,13 +451,19 @@ class ContainerTree(models.Model): FROM (SELECT * FROM containers_tree) y ORDER BY y.container_id, y.container_parent_id; - -- deactivate deletion + -- deactivate deletion, update CREATE RULE containers_tree_del AS ON DELETE TO containers_tree DO INSTEAD DELETE FROM archaeological_warehouse_container where id=NULL; CREATE RULE container_tree_del AS ON DELETE TO container_tree DO INSTEAD DELETE FROM archaeological_warehouse_container where id=NULL; + CREATE RULE containers_tree_update AS + ON UPDATE TO containers_tree + DO INSTEAD UPDATE archaeological_warehouse_container set id=id WHERE id=NULL; + CREATE RULE container_tree_update AS + ON UPDATE TO container_tree + DO INSTEAD UPDATE archaeological_warehouse_container set id=id WHERE id=NULL; """ DELETE_SQL = """ DROP VIEW IF EXISTS container_tree; |