Skip to content

Adding foreign key constraints to PowerDNS default schema

In an earlier post I made, I described how to manually create the SQL schema, because it didn’t itself. When I installed Power DNS 3.1-4 on a Raspberry Pi, I noticed it had created the scheme itself this time. However, it did not make the foreign key constraints. This is dumb. I regularly need to remove domains from the DB and I don’t want stale or incorrect references as a result.

To create them by hand:

alter table records add foreign key (domain_id) references domains(id) on delete cascade;
alter table cryptokeys add foreign key (domain_id) references domains(id) on delete cascade;
alter table domainmetadata add foreign key (domain_id) references domains(id) on delete cascade;

It must be a bug that this was omitted, because I got the original scheme from the PowerDNS website. Question is, is this a bug in the Rasbian/Debian package, or in PowerDNS?


    1 Comment ( Add comment / trackback )

    1. […] As I mentioned here, I had to manually create a database schema when I installed PowerDNS on Debian Squeeze. Later versions apparently create one themselve. […]

    Post a comment

    (required)
    (required)

    Your email is never published nor shared.

    (optional)
    Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>