Changeset 65 for trunk/dns.sql
- Timestamp:
- 11/25/10 16:26:08 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.sql
r50 r65 7 7 8 8 -- tabledefs and preloaded data bits 9 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 NULL 25 ); 26 27 -- Need *two* basic permissions; one for the initial group, one for the default admin user 28 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 n 30 2 y n n n n n n n n n n n n n 31 \. 32 9 33 CREATE TABLE groups ( 10 34 group_id serial NOT NULL, 11 35 parent_group_id integer DEFAULT 1 NOT NULL, 36 permission_id integer DEFAULT 1 NOT NULL, 12 37 group_name character varying(255) DEFAULT ''::character varying NOT NULL 13 38 ); … … 15 40 -- Provide a basic default group 16 41 COPY groups (group_id, parent_group_id, group_name) FROM stdin; 17 1 1 default42 1 1 1 default 18 43 \. 19 44 … … 151 176 "type" character(1) DEFAULT 'S'::bpchar NOT NULL, 152 177 status integer DEFAULT 1 NOT NULL, 153 acl character varying(40) DEFAULT 'b'::character varying NOT NULL 178 acl character varying(40) DEFAULT 'b'::character varying NOT NULL, 179 permission_id DEFAULT 1 NOT NULL, 154 180 ); 155 181 156 182 -- create initial default user? may be better to create an "initialize" script or something 157 183 COPY users (user_id, group_id, username, "password", firstname, lastname, phone, "type", status, acl) FROM stdin; 158 1 1 test@test $1$BByge8u2$48AaGX3YeHplfErX5Tlqa1 \N \N \N S 1 A 184 1 1 test@test $1$BByge8u2$48AaGX3YeHplfErX5Tlqa1 \N \N \N S 1 A 2 159 185 \. 160 186 … … 174 200 175 201 -- primary keys 202 ALTER TABLE ONLY permissions 203 ADD CONSTRAINT permissions_permission_id_key UNIQUE (permission_id); 204 176 205 ALTER TABLE ONLY groups 177 206 ADD CONSTRAINT groups_group_id_key UNIQUE (group_id); … … 199 228 200 229 -- foreign keys 230 -- fixme: permissions FK refs 201 231 ALTER TABLE ONLY domains 202 232 ADD CONSTRAINT "$1" FOREIGN KEY (group_id) REFERENCES groups(group_id); … … 216 246 -- set sequence start values - make sure we don't screw up adding 217 247 -- records to tables that already have a few entries 248 SELECT pg_catalog.setval('permissions_permission_id_seq', 2, true); 218 249 219 250 SELECT pg_catalog.setval('groups_group_id_seq', 52, true);
Note:
See TracChangeset
for help on using the changeset viewer.