Permalink
Browse files

add constraints for name to pg schema

  • Loading branch information...
1 parent f104427 commit 213ec4a39fc5ff97970219a37855a89e22e54533 @mind04 mind04 committed with mind04 Aug 6, 2013
Showing with 13 additions and 13 deletions.
  1. +5 −4 pdns/dnssec.schema.pgsql.sql
  2. +8 −9 pdns/no-dnssec.schema.pgsql.sql
@@ -9,7 +9,7 @@ create table domainmetadata (
content TEXT
);
-create index domainidmetaindex on domainmetadata(domain_id);
+create index domainidmetaindex on domainmetadata(domain_id);
create table cryptokeys (
@@ -18,7 +18,7 @@ create table cryptokeys (
flags INT NOT NULL,
active BOOL,
content TEXT
-);
+);
create index domainidindex on cryptokeys(domain_id);
@@ -30,8 +30,9 @@ create index domainidindex on cryptokeys(domain_id);
create table tsigkeys (
id SERIAL PRIMARY KEY,
name VARCHAR(255),
- algorithm VARCHAR(50),
- secret VARCHAR(255)
+ algorithm VARCHAR(50),
+ secret VARCHAR(255),
+ constraint c_lowercase_name check (((name)::text = lower((name)::text)))
);
create unique index namealgoindex on tsigkeys(name, algorithm);
@@ -4,11 +4,12 @@ create table domains (
master VARCHAR(128) DEFAULT NULL,
last_check INT DEFAULT NULL,
type VARCHAR(6) NOT NULL,
- notified_serial INT DEFAULT NULL,
- account VARCHAR(40) DEFAULT NULL
+ notified_serial INT DEFAULT NULL,
+ account VARCHAR(40) DEFAULT NULL,
+ CONSTRAINT c_lowercase_name CHECK (((name)::text = lower((name)::text)))
);
CREATE UNIQUE INDEX name_index ON domains(name);
-
+
CREATE TABLE records (
id SERIAL PRIMARY KEY,
domain_id INT DEFAULT NULL,
@@ -17,8 +18,8 @@ CREATE TABLE records (
content VARCHAR(65535) DEFAULT NULL,
ttl INT DEFAULT NULL,
prio INT DEFAULT NULL,
- change_date INT DEFAULT NULL,
- CONSTRAINT domain_exists
+ change_date INT DEFAULT NULL,
+ CONSTRAINT domain_exists
FOREIGN KEY(domain_id) REFERENCES domains(id)
ON DELETE CASCADE,
CONSTRAINT c_lowercase_name CHECK (((name)::text = lower((name)::text)))
@@ -29,8 +30,8 @@ CREATE INDEX nametype_index ON records(name,type);
CREATE INDEX domain_id ON records(domain_id);
create table supermasters (
- ip VARCHAR(64) NOT NULL,
- nameserver VARCHAR(255) NOT NULL,
+ ip VARCHAR(64) NOT NULL,
+ nameserver VARCHAR(255) NOT NULL,
account VARCHAR(40) DEFAULT NULL
);
@@ -39,5 +40,3 @@ create table supermasters (
-- GRANT ALL ON domains_id_seq TO pdns;
-- GRANT ALL ON records TO pdns;
-- GRANT ALL ON records_id_seq TO pdns;
-
-

0 comments on commit 213ec4a

Please sign in to comment.