db.sqlite: fix the delete constraint for the restrict case
parent
66083e263c
commit
ebdf57d175
|
@ -15,7 +15,7 @@ ${
|
||||||
"SELECT RAISE(ROLLBACK, "
|
"SELECT RAISE(ROLLBACK, "
|
||||||
"'delete on table \"NODE\" violates "
|
"'delete on table \"NODE\" violates "
|
||||||
"foreign key constraint \"fkd_TREE_NODE_NODE_ID_id\"') "
|
"foreign key constraint \"fkd_TREE_NODE_NODE_ID_id\"') "
|
||||||
"WHERE (SELECT ID FROM NODE WHERE ID = OLD.ID) IS NOT NULL; END;"
|
"WHERE (SELECT NODE FROM TREE WHERE NODE = OLD.ID) IS NOT NULL; END;"
|
||||||
} concat
|
} concat
|
||||||
} [
|
} [
|
||||||
{
|
{
|
||||||
|
@ -203,6 +203,7 @@ watch "WATCH" {
|
||||||
watch boa insert-tuple
|
watch boa insert-tuple
|
||||||
watch new select-tuple
|
watch new select-tuple
|
||||||
user>> f user boa select-tuple
|
user>> f user boa select-tuple
|
||||||
|
user new "mark" >>username delete-tuples
|
||||||
] with-db
|
] with-db
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,7 @@ M: sqlite-db-connection persistent-table ( -- assoc )
|
||||||
BEFORE DELETE ON ${foreign-table-name}
|
BEFORE DELETE ON ${foreign-table-name}
|
||||||
FOR EACH ROW BEGIN
|
FOR EACH ROW BEGIN
|
||||||
SELECT RAISE(ROLLBACK, 'delete on table \"${foreign-table-name}\" violates foreign key constraint \"fkd_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id\"')
|
SELECT RAISE(ROLLBACK, 'delete on table \"${foreign-table-name}\" violates foreign key constraint \"fkd_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id\"')
|
||||||
WHERE (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = OLD.${foreign-table-id}) IS NOT NULL;
|
WHERE (SELECT ${table-id} FROM ${table-name} WHERE ${table-id} = OLD.${foreign-table-id}) IS NOT NULL;
|
||||||
END;
|
END;
|
||||||
" interpolate>string ;
|
" interpolate>string ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue