COMMIT;
+CREATE VIEW v_domainmetadata AS
+ SELECT md.id AS metadata_id,
+ md.domain_id,
+ d.name AS domain_name,
+ md.kind AS metadata_kind,
+ md.content AS metadata_content,
+ d.master AS domain_master,
+ d.last_check AS domain_last_check,
+ d.type AS domain_type,
+ d.notified_serial AS domain_serial,
+ d.account AS domain_account
+ FROM domainmetadata md
+ LEFT JOIN domains d ON md.domain_id = d.id
+ ORDER BY d.name, md.kind;
+ALTER VIEW IF EXISTS v_domainmetadata OWNER TO pdns;
+
+CREATE VIEW v_records AS
+ SELECT r.id AS record_id,
+ r.domain_id,
+ r.name AS record_name,
+ r.type AS record_type,
+ r.content AS record_content,
+ r.ttl AS record_ttl,
+ r.prio AS record_prio,
+ r.change_date AS record_change_date,
+ r.disabled AS record_disabled,
+ r.ordername AS record_ordername,
+ r.auth AS record_auth,
+ d.name AS domain_name,
+ d.master AS domain_master,
+ d.last_check AS domain_last_check,
+ d.type AS domain_type,
+ d.notified_serial AS domain_notified_serial,
+ d.account AS domain_account,
+ c.id AS comment_id,
+ c.name AS comment_name,
+ c.type AS comment_type,
+ c.modified_at AS comment_modified_at,
+ c.account AS comment_account,
+ c.comment
+ FROM records r
+ LEFT JOIN domains d ON d.id = r.domain_id
+ LEFT JOIN comments c ON r.name::text = c.name::text AND r.type::text = c.type::text
+ ORDER BY d.name, r.name;
+ALTER VIEW IF EXISTS v_records OWNER TO pdns;
+
+
-- Enabling automatic SOA serial update after importing all data