Cascading Delete
Posted: 2022-08-01 14:05
It would be great if AppGini had the ability to cascade delete all children records when a parent record is deleted. Just a thought.
A place where AppGini users can exchange ideas and help each other.
https://forums.appgini.com:443/phpbb/
https://forums.appgini.com:443/phpbb/viewtopic.php?f=6&t=4843
[x] Delete records even if they have children records
[X] Allow mass delete
on the master tableTABLENAME_delete()
in TABLENAME_dml.php
. All related subtables should have a separate block of code, starting with // child table: SUBTABLENAME
. If your code does not delete related records of certain tables, check if those tables do have a separate code-block there. If not, I guess there is a problem with setup of that specific lookup._before_delete()
-hook. After deleting all child-records manually you should also cleanup orphanened membership_userrecords
.A
, B
with B.a_id = A.id
A_after_delete
-hook you should get primary key of deleted record in $selectedID
variable. Code: Select all
$cmd = "DELETE FROM B WHERE B.a_id = '{$selectedID}'";
$eo = [];
sql($cmd, $eo);
membership_userrecords
, too.