- Timestamp:
- 03/04/11 17:49:38 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.sql
r65 r85 5 5 -- CREATE DATABASE dnsdb OWNED BY dnsdb; 6 6 -- SET SESSION AUTHORIZATION 'dnsdb'; 7 8 -- tabledefs and preloaded data bits9 CREATE TABLE permissions (10 permission_id SERIAL NOT NULL,11 admin boolean DEFAULT 'n' NOT NULL,12 self_edit boolean DEFAULT 'n' NOT NULL,13 group_create boolean DEFAULT 'n' NOT NULL,14 group_edit boolean DEFAULT 'n' NOT NULL,15 group_delete boolean DEFAULT 'n' NOT NULL,16 user_create boolean DEFAULT 'n' NOT NULL,17 user_edit boolean DEFAULT 'n' NOT NULL,18 user_delete boolean DEFAULT 'n' NOT NULL,19 domain_create boolean DEFAULT 'n' NOT NULL,20 domain_edit boolean DEFAULT 'n' NOT NULL,21 domain_delete boolean DEFAULT 'n' NOT NULL,22 record_create boolean DEFAULT 'n' NOT NULL,23 record_edit boolean DEFAULT 'n' NOT NULL,24 record_delete boolean DEFAULT 'n' NOT NULL25 );26 27 -- Need *two* basic permissions; one for the initial group, one for the default admin user28 COPY permissions (permission_id, admin, self_edit, group_create, group_edit group_delete, user_create, user_edit, user_delete, domain_create, domain_edit, domain_delete, record_create, record_edit, record_delete) FROM stdin;29 1 n n n n n n n n n n n n n n30 2 y n n n n n n n n n n n n n31 \.32 33 CREATE TABLE groups (34 group_id serial NOT NULL,35 parent_group_id integer DEFAULT 1 NOT NULL,36 permission_id integer DEFAULT 1 NOT NULL,37 group_name character varying(255) DEFAULT ''::character varying NOT NULL38 );39 40 -- Provide a basic default group41 COPY groups (group_id, parent_group_id, group_name) FROM stdin;42 1 1 1 default43 \.44 45 CREATE TABLE domains (46 domain_id serial NOT NULL,47 "domain" character varying(80) NOT NULL,48 group_id integer DEFAULT 1 NOT NULL,49 description character varying(255) DEFAULT ''::character varying NOT NULL,50 status integer DEFAULT 1 NOT NULL,51 zserial integer,52 sertype character(1) DEFAULT 'D'::bpchar53 );54 7 55 8 CREATE TABLE default_records ( … … 77 30 \. 78 31 32 CREATE TABLE domains ( 33 domain_id serial NOT NULL, 34 "domain" character varying(80) NOT NULL, 35 group_id integer DEFAULT 1 NOT NULL, 36 description character varying(255) DEFAULT ''::character varying NOT NULL, 37 status integer DEFAULT 1 NOT NULL, 38 zserial integer, 39 sertype character(1) DEFAULT 'D'::bpchar 40 ); 41 42 CREATE TABLE groups ( 43 group_id serial NOT NULL, 44 parent_group_id integer DEFAULT 1 NOT NULL, 45 group_name character varying(255) DEFAULT ''::character varying NOT NULL, 46 permission_id integer DEFAULT 1 NOT NULL, 47 inherit_perm boolean DEFAULT true NOT NULL 48 ); 49 50 -- Provide a basic default group 51 COPY groups (group_id, parent_group_id, group_name) FROM stdin; 52 1 1 1 default 53 \. 54 55 CREATE TABLE log ( 56 domain_id integer, 57 user_id integer, 58 group_id integer, 59 email character varying(60), 60 name character varying(60), 61 entry character varying(200), 62 stamp timestamp with time zone DEFAULT now() 63 ); 64 65 CREATE TABLE permissions ( 66 permission_id serial NOT NULL, 67 "admin" boolean DEFAULT false NOT NULL, 68 self_edit boolean DEFAULT false NOT NULL, 69 group_create boolean DEFAULT false NOT NULL, 70 group_edit boolean DEFAULT false NOT NULL, 71 group_delete boolean DEFAULT false NOT NULL, 72 user_create boolean DEFAULT false NOT NULL, 73 user_edit boolean DEFAULT false NOT NULL, 74 user_delete boolean DEFAULT false NOT NULL, 75 domain_create boolean DEFAULT false NOT NULL, 76 domain_edit boolean DEFAULT false NOT NULL, 77 domain_delete boolean DEFAULT false NOT NULL, 78 record_create boolean DEFAULT false NOT NULL, 79 record_edit boolean DEFAULT false NOT NULL, 80 record_delete boolean DEFAULT false NOT NULL, 81 user_id integer DEFAULT 0 NOT NULL, 82 group_id integer DEFAULT 0 NOT NULL 83 ); 84 85 -- Need *two* basic permissions; one for the initial group, one for the default admin user 86 COPY permissions (permission_id, admin, self_edit, group_create, group_edit group_delete, user_create, user_edit, user_delete, domain_create, domain_edit, domain_delete, record_create, record_edit, record_delete) FROM stdin; 87 1 n n n n n n n n n n n n n n 88 2 y n n n n n n n n n n n n n 89 \. 90 91 -- fixeme: need to handle looooong TXT records (eg, SPF) 79 92 CREATE TABLE records ( 80 93 domain_id integer NOT NULL, … … 86 99 weight integer DEFAULT 0 NOT NULL, 87 100 port integer DEFAULT 0 NOT NULL, 88 ttl integer DEFAULT 86400 NOT NULL,101 ttl integer DEFAULT 7200 NOT NULL, 89 102 description character varying(255) 90 103 ); … … 98 111 99 112 -- Types are required. NB: these are vaguely read-only too 113 -- data from http://www.iana.org/assignments/dns-parameters 100 114 COPY rectypes (val, name, stdflag, listorder) FROM stdin; 101 115 1 A 1 1 … … 171 185 username character varying(60) NOT NULL, 172 186 "password" character varying(34) NOT NULL, 173 firstname character varying( 30),174 lastname character varying( 30),187 firstname character varying(60), 188 lastname character varying(60), 175 189 phone character varying(15), 176 190 "type" character(1) DEFAULT 'S'::bpchar NOT NULL, 177 191 status integer DEFAULT 1 NOT NULL, 178 acl character varying(40) DEFAULT 'b'::character varyingNOT NULL,179 permission_id DEFAULT 1 NOT NULL,192 permission_id integer DEFAULT 1 NOT NULL, 193 inherit_perm boolean DEFAULT true NOT NULL 180 194 ); 181 195 … … 184 198 1 1 test@test $1$BByge8u2$48AaGX3YeHplfErX5Tlqa1 \N \N \N S 1 A 2 185 199 \. 186 187 CREATE TABLE log (188 domain_id integer,189 user_id integer,190 group_id integer,191 email character varying(60),192 name character varying(60),193 entry character varying(200),194 stamp timestamp with time zone195 );196 200 197 201 -- … … 243 247 ALTER TABLE ONLY groups 244 248 ADD CONSTRAINT group_parent FOREIGN KEY (parent_group_id) REFERENCES groups(group_id); 245 246 -- set sequence start values - make sure we don't screw up adding247 -- records to tables that already have a few entries248 SELECT pg_catalog.setval('permissions_permission_id_seq', 2, true);249 250 SELECT pg_catalog.setval('groups_group_id_seq', 52, true);251 252 SELECT pg_catalog.setval('domains_domain_id_seq', 953, true);253 254 SELECT pg_catalog.setval('default_records_record_id_seq', 320, true);255 256 SELECT pg_catalog.setval('records_record_id_seq', 660, true);257 258 SELECT pg_catalog.setval('users_user_id_seq', 37, true);
Note:
See TracChangeset
for help on using the changeset viewer.