You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

powerdns-pgsql-db-structure.sql 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. create table domains (
  2. id SERIAL PRIMARY KEY,
  3. name VARCHAR(255) NOT NULL,
  4. master VARCHAR(128) DEFAULT NULL,
  5. last_check INT DEFAULT NULL,
  6. type VARCHAR(6) NOT NULL,
  7. notified_serial INT DEFAULT NULL,
  8. account VARCHAR(40) DEFAULT NULL,
  9. CONSTRAINT c_lowercase_name CHECK (((name)::text = lower((name)::text)))
  10. );
  11. CREATE UNIQUE INDEX name_index ON domains(name);
  12. CREATE TABLE records (
  13. id SERIAL PRIMARY KEY,
  14. domain_id INT DEFAULT NULL,
  15. name VARCHAR(255) DEFAULT NULL,
  16. type VARCHAR(10) DEFAULT NULL,
  17. content VARCHAR(65535) DEFAULT NULL,
  18. ttl INT DEFAULT NULL,
  19. prio INT DEFAULT NULL,
  20. change_date INT DEFAULT NULL,
  21. disabled BOOL DEFAULT 'f',
  22. CONSTRAINT domain_exists
  23. FOREIGN KEY(domain_id) REFERENCES domains(id)
  24. ON DELETE CASCADE,
  25. CONSTRAINT c_lowercase_name CHECK (((name)::text = lower((name)::text)))
  26. );
  27. CREATE INDEX rec_name_index ON records(name);
  28. CREATE INDEX nametype_index ON records(name,type);
  29. CREATE INDEX domain_id ON records(domain_id);
  30. create table supermasters (
  31. ip INET NOT NULL,
  32. nameserver VARCHAR(255) NOT NULL,
  33. account VARCHAR(40) DEFAULT NULL,
  34. PRIMARY KEY (ip, nameserver)
  35. );
  36. CREATE TABLE comments (
  37. id SERIAL PRIMARY KEY,
  38. domain_id INT NOT NULL,
  39. name VARCHAR(255) NOT NULL,
  40. type VARCHAR(10) NOT NULL,
  41. modified_at INT NOT NULL,
  42. account VARCHAR(40) DEFAULT NULL,
  43. comment VARCHAR(65535) NOT NULL,
  44. CONSTRAINT domain_exists
  45. FOREIGN KEY(domain_id) REFERENCES domains(id)
  46. ON DELETE CASCADE,
  47. CONSTRAINT c_lowercase_name CHECK (((name)::text = lower((name)::text)))
  48. );
  49. CREATE INDEX comments_domain_id_idx ON comments (domain_id);
  50. CREATE INDEX comments_name_type_idx ON comments (name, type);
  51. CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);