--
-- PostgreSQL database dump
--

-- Dumped from database version 9.6.1
-- Dumped by pg_dump version 9.6.1

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;

--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;


--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--

COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';


SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: comments; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE comments (
    id integer NOT NULL,
    domain_id integer NOT NULL,
    name character varying(255) NOT NULL,
    type character varying(10) NOT NULL,
    modified_at integer NOT NULL,
    account character varying(40) DEFAULT NULL::character varying,
    comment character varying(65535) NOT NULL,
    CONSTRAINT c_lowercase_name CHECK (((name)::text = lower((name)::text)))
);


--
-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE comments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE comments_id_seq OWNED BY comments.id;


--
-- Name: cryptokeys; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE cryptokeys (
    id integer NOT NULL,
    domain_id integer,
    flags integer NOT NULL,
    active boolean,
    content text
);


--
-- Name: cryptokeys_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE cryptokeys_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: cryptokeys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE cryptokeys_id_seq OWNED BY cryptokeys.id;


--
-- Name: domainmetadata; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE domainmetadata (
    id integer NOT NULL,
    domain_id integer,
    kind character varying(32),
    content text
);


--
-- Name: domainmetadata_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE domainmetadata_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: domainmetadata_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE domainmetadata_id_seq OWNED BY domainmetadata.id;


--
-- Name: domains; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE domains (
    id integer NOT NULL,
    name character varying(255) NOT NULL,
    master character varying(128) DEFAULT NULL::character varying,
    last_check integer,
    type character varying(6) NOT NULL,
    notified_serial integer,
    account character varying(40) DEFAULT NULL::character varying,
    CONSTRAINT c_lowercase_name CHECK (((name)::text = lower((name)::text)))
);


--
-- Name: domains_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE domains_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: domains_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE domains_id_seq OWNED BY domains.id;


--
-- Name: migrations; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE migrations (
    domain_id character varying(255),
    record_id integer
);


--
-- Name: perm_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE perm_items (
    id integer NOT NULL,
    name character varying(64),
    descr character varying(1024)
);


--
-- Name: perm_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE perm_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: perm_items_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE perm_items_id_seq OWNED BY perm_items.id;


--
-- Name: perm_templ; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE perm_templ (
    id integer NOT NULL,
    name character varying(128),
    descr character varying(1024)
);


--
-- Name: perm_templ_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE perm_templ_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: perm_templ_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE perm_templ_id_seq OWNED BY perm_templ.id;


--
-- Name: perm_templ_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE perm_templ_items (
    id integer NOT NULL,
    templ_id integer,
    perm_id integer
);


--
-- Name: perm_templ_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE perm_templ_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: perm_templ_items_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE perm_templ_items_id_seq OWNED BY perm_templ_items.id;


--
-- Name: records; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE records (
    id integer NOT NULL,
    domain_id integer,
    name character varying(255) DEFAULT NULL::character varying,
    type character varying(10) DEFAULT NULL::character varying,
    content character varying(65535) DEFAULT NULL::character varying,
    ttl integer,
    prio integer,
    change_date integer,
    disabled boolean DEFAULT false,
    ordername character varying(255),
    auth boolean DEFAULT true,
    CONSTRAINT c_lowercase_name CHECK (((name)::text = lower((name)::text)))
);


--
-- Name: records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE records_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE records_id_seq OWNED BY records.id;


--
-- Name: records_zone_templ; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE records_zone_templ (
    domain_id integer,
    record_id integer,
    zone_templ_id integer
);


--
-- Name: supermasters; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE supermasters (
    ip inet NOT NULL,
    nameserver character varying(255) NOT NULL,
    account character varying(40) NOT NULL
);


--
-- Name: tsigkeys; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE tsigkeys (
    id integer NOT NULL,
    name character varying(255),
    algorithm character varying(50),
    secret character varying(255),
    CONSTRAINT c_lowercase_name CHECK (((name)::text = lower((name)::text)))
);


--
-- Name: tsigkeys_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE tsigkeys_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: tsigkeys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE tsigkeys_id_seq OWNED BY tsigkeys.id;


--
-- Name: users; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE users (
    id integer NOT NULL,
    username character varying(64),
    password character varying(128),
    fullname character varying(255),
    email character varying(255),
    description character varying(1024),
    perm_templ integer,
    active integer,
    use_ldap integer
);


--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE users_id_seq OWNED BY users.id;


--
-- Name: zone_templ; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE zone_templ (
    id integer NOT NULL,
    name character varying(128),
    descr character varying(1024),
    owner integer
);


--
-- Name: zone_templ_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE zone_templ_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: zone_templ_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE zone_templ_id_seq OWNED BY zone_templ.id;


--
-- Name: zone_templ_records; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE zone_templ_records (
    id integer NOT NULL,
    zone_templ_id integer,
    name character varying(255),
    type character varying(6),
    content character varying(255),
    ttl integer,
    prio integer
);


--
-- Name: zone_templ_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE zone_templ_records_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: zone_templ_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE zone_templ_records_id_seq OWNED BY zone_templ_records.id;


--
-- Name: zones; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE zones (
    id integer NOT NULL,
    domain_id integer,
    owner integer,
    comment character varying(1024),
    zone_templ_id integer
);


--
-- Name: zones_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE zones_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: zones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE zones_id_seq OWNED BY zones.id;


--
-- Name: comments id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass);


--
-- Name: cryptokeys id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY cryptokeys ALTER COLUMN id SET DEFAULT nextval('cryptokeys_id_seq'::regclass);


--
-- Name: domainmetadata id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY domainmetadata ALTER COLUMN id SET DEFAULT nextval('domainmetadata_id_seq'::regclass);


--
-- Name: domains id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY domains ALTER COLUMN id SET DEFAULT nextval('domains_id_seq'::regclass);


--
-- Name: perm_items id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY perm_items ALTER COLUMN id SET DEFAULT nextval('perm_items_id_seq'::regclass);


--
-- Name: perm_templ id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY perm_templ ALTER COLUMN id SET DEFAULT nextval('perm_templ_id_seq'::regclass);


--
-- Name: perm_templ_items id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY perm_templ_items ALTER COLUMN id SET DEFAULT nextval('perm_templ_items_id_seq'::regclass);


--
-- Name: records id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY records ALTER COLUMN id SET DEFAULT nextval('records_id_seq'::regclass);


--
-- Name: tsigkeys id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY tsigkeys ALTER COLUMN id SET DEFAULT nextval('tsigkeys_id_seq'::regclass);


--
-- Name: users id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);


--
-- Name: zone_templ id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY zone_templ ALTER COLUMN id SET DEFAULT nextval('zone_templ_id_seq'::regclass);


--
-- Name: zone_templ_records id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY zone_templ_records ALTER COLUMN id SET DEFAULT nextval('zone_templ_records_id_seq'::regclass);


--
-- Name: zones id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY zones ALTER COLUMN id SET DEFAULT nextval('zones_id_seq'::regclass);


--
-- Data for Name: comments; Type: TABLE DATA; Schema: public; Owner: -
--

COPY comments (id, domain_id, name, type, modified_at, account, comment) FROM stdin;
\.


--
-- Name: comments_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('comments_id_seq', 1, false);


--
-- Data for Name: cryptokeys; Type: TABLE DATA; Schema: public; Owner: -
--

COPY cryptokeys (id, domain_id, flags, active, content) FROM stdin;
\.


--
-- Name: cryptokeys_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('cryptokeys_id_seq', 1, false);


--
-- Data for Name: domainmetadata; Type: TABLE DATA; Schema: public; Owner: -
--

COPY domainmetadata (id, domain_id, kind, content) FROM stdin;
\.


--
-- Name: domainmetadata_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('domainmetadata_id_seq', 1, false);


--
-- Data for Name: domains; Type: TABLE DATA; Schema: public; Owner: -
--

COPY domains (id, name, master, last_check, type, notified_serial, account) FROM stdin;
\.


--
-- Name: domains_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('domains_id_seq', 1, false);


--
-- Data for Name: migrations; Type: TABLE DATA; Schema: public; Owner: -
--

COPY migrations (domain_id, record_id) FROM stdin;
\.


--
-- Data for Name: perm_items; Type: TABLE DATA; Schema: public; Owner: -
--

COPY perm_items (id, name, descr) FROM stdin;
41	zone_master_add	User is allowed to add new master zones.
42	zone_slave_add	User is allowed to add new slave zones.
43	zone_content_view_own	User is allowed to see the content and meta data of zones he owns.
44	zone_content_edit_own	User is allowed to edit the content of zones he owns.
45	zone_meta_edit_own	User is allowed to edit the meta data of zones he owns.
46	zone_content_view_others	User is allowed to see the content and meta data of zones he does not own.
47	zone_content_edit_others	User is allowed to edit the content of zones he does not own.
48	zone_meta_edit_others	User is allowed to edit the meta data of zones he does not own.
49	search	User is allowed to perform searches.
50	supermaster_view	User is allowed to view supermasters.
51	supermaster_add	User is allowed to add new supermasters.
52	supermaster_edit	User is allowed to edit supermasters.
53	user_is_ueberuser	User has full access. God-like. Redeemer.
54	user_view_others	User is allowed to see other users and their details.
55	user_add_new	User is allowed to add new users.
56	user_edit_own	User is allowed to edit their own details.
57	user_edit_others	User is allowed to edit other users.
58	user_passwd_edit_others	User is allowed to edit the password of other users.
59	user_edit_templ_perm	User is allowed to change the permission template that is assigned to a user.
60	templ_perm_add	User is allowed to add new permission templates.
61	templ_perm_edit	User is allowed to edit existing permission templates.
\.


--
-- Name: perm_items_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('perm_items_id_seq', 1, false);


--
-- Data for Name: perm_templ; Type: TABLE DATA; Schema: public; Owner: -
--

COPY perm_templ (id, name, descr) FROM stdin;
1	Administrator	Administrator template with full rights.
\.


--
-- Name: perm_templ_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('perm_templ_id_seq', 1, true);


--
-- Data for Name: perm_templ_items; Type: TABLE DATA; Schema: public; Owner: -
--

COPY perm_templ_items (id, templ_id, perm_id) FROM stdin;
1	1	53
\.


--
-- Name: perm_templ_items_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('perm_templ_items_id_seq', 1, true);


--
-- Data for Name: records; Type: TABLE DATA; Schema: public; Owner: -
--

COPY records (id, domain_id, name, type, content, ttl, prio, change_date, disabled, ordername, auth) FROM stdin;
\.


--
-- Name: records_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('records_id_seq', 1, false);


--
-- Data for Name: records_zone_templ; Type: TABLE DATA; Schema: public; Owner: -
--

COPY records_zone_templ (domain_id, record_id, zone_templ_id) FROM stdin;
\.


--
-- Data for Name: supermasters; Type: TABLE DATA; Schema: public; Owner: -
--

COPY supermasters (ip, nameserver, account) FROM stdin;
\.


--
-- Data for Name: tsigkeys; Type: TABLE DATA; Schema: public; Owner: -
--

COPY tsigkeys (id, name, algorithm, secret) FROM stdin;
\.


--
-- Name: tsigkeys_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('tsigkeys_id_seq', 1, false);


--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: -
--

COPY users (id, username, password, fullname, email, description, perm_templ, active, use_ldap) FROM stdin;
1	admin	53525674bdec5b712080dfcc760402bd	Administrator	admin@example.net	Administrator with full rights.	1	1	0
\.


--
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('users_id_seq', 1, true);


--
-- Data for Name: zone_templ; Type: TABLE DATA; Schema: public; Owner: -
--

COPY zone_templ (id, name, descr, owner) FROM stdin;
\.


--
-- Name: zone_templ_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('zone_templ_id_seq', 1, false);


--
-- Data for Name: zone_templ_records; Type: TABLE DATA; Schema: public; Owner: -
--

COPY zone_templ_records (id, zone_templ_id, name, type, content, ttl, prio) FROM stdin;
\.


--
-- Name: zone_templ_records_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('zone_templ_records_id_seq', 1, false);


--
-- Data for Name: zones; Type: TABLE DATA; Schema: public; Owner: -
--

COPY zones (id, domain_id, owner, comment, zone_templ_id) FROM stdin;
\.


--
-- Name: zones_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('zones_id_seq', 1, false);


--
-- Name: comments comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY comments
    ADD CONSTRAINT comments_pkey PRIMARY KEY (id);


--
-- Name: cryptokeys cryptokeys_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY cryptokeys
    ADD CONSTRAINT cryptokeys_pkey PRIMARY KEY (id);


--
-- Name: domainmetadata domainmetadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY domainmetadata
    ADD CONSTRAINT domainmetadata_pkey PRIMARY KEY (id);


--
-- Name: domains domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY domains
    ADD CONSTRAINT domains_pkey PRIMARY KEY (id);


--
-- Name: perm_items perm_items_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY perm_items
    ADD CONSTRAINT perm_items_pkey PRIMARY KEY (id);


--
-- Name: perm_templ_items perm_templ_items_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY perm_templ_items
    ADD CONSTRAINT perm_templ_items_pkey PRIMARY KEY (id);


--
-- Name: perm_templ perm_templ_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY perm_templ
    ADD CONSTRAINT perm_templ_pkey PRIMARY KEY (id);


--
-- Name: records records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY records
    ADD CONSTRAINT records_pkey PRIMARY KEY (id);


--
-- Name: supermasters supermasters_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY supermasters
    ADD CONSTRAINT supermasters_pkey PRIMARY KEY (ip, nameserver);


--
-- Name: tsigkeys tsigkeys_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY tsigkeys
    ADD CONSTRAINT tsigkeys_pkey PRIMARY KEY (id);


--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY users
    ADD CONSTRAINT users_pkey PRIMARY KEY (id);


--
-- Name: zone_templ zone_templ_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY zone_templ
    ADD CONSTRAINT zone_templ_pkey PRIMARY KEY (id);


--
-- Name: zone_templ_records zone_templ_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY zone_templ_records
    ADD CONSTRAINT zone_templ_records_pkey PRIMARY KEY (id);


--
-- Name: zones zones_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY zones
    ADD CONSTRAINT zones_pkey PRIMARY KEY (id);


--
-- Name: comments_domain_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX comments_domain_id_idx ON comments USING btree (domain_id);


--
-- Name: comments_name_type_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX comments_name_type_idx ON comments USING btree (name, type);


--
-- Name: comments_order_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX comments_order_idx ON comments USING btree (domain_id, modified_at);


--
-- Name: domain_id; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX domain_id ON records USING btree (domain_id);


--
-- Name: domainidindex; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX domainidindex ON cryptokeys USING btree (domain_id);


--
-- Name: domainidmetaindex; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX domainidmetaindex ON domainmetadata USING btree (domain_id);


--
-- Name: name_index; Type: INDEX; Schema: public; Owner: -
--

CREATE UNIQUE INDEX name_index ON domains USING btree (name);


--
-- Name: namealgoindex; Type: INDEX; Schema: public; Owner: -
--

CREATE UNIQUE INDEX namealgoindex ON tsigkeys USING btree (name, algorithm);


--
-- Name: nametype_index; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX nametype_index ON records USING btree (name, type);


--
-- Name: rec_name_index; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX rec_name_index ON records USING btree (name);


--
-- Name: recordorder; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX recordorder ON records USING btree (domain_id, ordername text_pattern_ops);


--
-- Name: cryptokeys cryptokeys_domain_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY cryptokeys
    ADD CONSTRAINT cryptokeys_domain_id_fkey FOREIGN KEY (domain_id) REFERENCES domains(id) ON DELETE CASCADE;


--
-- Name: records domain_exists; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY records
    ADD CONSTRAINT domain_exists FOREIGN KEY (domain_id) REFERENCES domains(id) ON DELETE CASCADE;


--
-- Name: comments domain_exists; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY comments
    ADD CONSTRAINT domain_exists FOREIGN KEY (domain_id) REFERENCES domains(id) ON DELETE CASCADE;


--
-- Name: domainmetadata domainmetadata_domain_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY domainmetadata
    ADD CONSTRAINT domainmetadata_domain_id_fkey FOREIGN KEY (domain_id) REFERENCES domains(id) ON DELETE CASCADE;


--
-- PostgreSQL database dump complete
--

