automatism to delete related records
Archived from the Xataface Users forum.
kurisusan — Sun Feb 10, 2008 5:24 am
Hello,
is there any automatism to delete related records after having deleted a ‘parent’ record?
Christian
shannah — Sun Feb 10, 2008 9:23 am
Best way is to use the INNODB storage engine for those tables, and then use a foreign key relationship with “on delete cascade”.
That way the database will always stay consistent.
The alternative is to use an afterDelete() trigger in the parent record to delete the child.
kurisusan — Sun Feb 10, 2008 10:31 am
Thanks. I cannot change the db enginge, though.
As Record->delete() is not implemented, how do I delete a record? Using plain sql?
Christian
shannah — Sun Feb 10, 2008 6:03 pm
Yes. Best just to do mysql_query()