[Pdns-users] Cascading Deletes (MySQL)

Mark Watts m.watts at eris.qinetiq.com
Fri Apr 21 10:29:17 UTC 2006


> Not sure how useful this will be to people, but its a trick I've used on a
> few nameservers we have here and thought it useful to share.
>
> When you create the "records" table in MySQL, add the following line:
>
> CONSTRAINT `records_ibfk_1` FOREIGN KEY (`domain_id`) REFERENCES `domains`
> (`id`) ON DELETE CASCADE
>
> (This implies you're using the InnoDB table type.)
>
> What this does is to automatically delete all records for a domain when the
> domain entry is removed from the "domains" table, thus being a more
> reliable way to clean up when you no-longer host a domain.
>
> Cheers,
>
> Mark.

Having read a little further into the "MySQL Specifics" secion of the 
documentation, I see this is already mentioned.

Sorry for the noise!

-- 
Mark Watts BSc RHCE
Senior Systems Engineer
QinetiQ Trusted Information Management
Trusted Solutions and Services Group
GPG Public Key ID: 455420ED



More information about the Pdns-users mailing list