Ignore:
Timestamp:
12/11/13 16:01:18 (10 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Merge reverse DNS work and object conversion from /trunk, part 5

Includes changes through r543 with a few more minor conflicts.

Location:
branches/stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/stable

  • branches/stable/dns.sql

    r547 r548  
    7878    default_location character varying (4) DEFAULT '' NOT NULL
    7979);
     80-- ~2x performance boost iff most zones are fed to output from the cache
     81CREATE INDEX dom_status_index ON domains (status);
     82
    8083
    8184CREATE TABLE revzones (
     
    9093    default_location character varying (4) DEFAULT '' NOT NULL
    9194);
     95CREATE INDEX rev_status_index ON revzones USING btree (status);
    9296
    9397CREATE TABLE groups (
     
    109113    log_id serial NOT NULL,
    110114    domain_id integer,
    111     rdns_id integer,
    112115    user_id integer,
    113116    group_id integer,
     
    115118    name character varying(60),
    116119    entry text,
    117     stamp timestamp with time zone DEFAULT now()
     120    stamp timestamp with time zone DEFAULT now(),
     121    rdns_id integer
    118122);
    119123
     
    134138    record_edit boolean DEFAULT false NOT NULL,
    135139    record_delete boolean DEFAULT false NOT NULL,
     140    user_id integer UNIQUE,
     141    group_id integer UNIQUE,
    136142    record_locchg boolean DEFAULT false NOT NULL,
    137143    location_create boolean DEFAULT false NOT NULL,
    138144    location_edit boolean DEFAULT false NOT NULL,
    139145    location_delete boolean DEFAULT false NOT NULL,
    140     location_view boolean DEFAULT false NOT NULL,
    141     user_id integer UNIQUE,
    142     group_id integer UNIQUE
     146    location_view boolean DEFAULT false NOT NULL
    143147);
    144148
    145149-- Need *two* basic permissions;  one for the initial group, one for the default admin user
    146 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, record_locchg, location_create, location_edit, location_delete, location_view, user_id, group_id) FROM stdin;
    147 1       f       f       f       f       f       f       f       f       t       t       t       t       t       t       f       f       f       f       f       \N      1
    148 2       t       f       f       f       f       f       f       f       f       f       f       f       f       f       f       f       f       f       f       1       \N
     150COPY 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, user_id, group_id, record_locchg, location_create, location_edit, location_delete, location_view) FROM stdin;
     1511       f       f       f       f       f       f       f       f       t       t       t       t       t       t       \N      1       f       f       f       f       f
     1522       t       f       f       f       f       f       f       f       f       f       f       f       f       f       1       \N      f       f       f       f       f
    149153\.
    150154
     
    152156CREATE TABLE records (
    153157    domain_id integer NOT NULL DEFAULT 0,
    154     rdns_id integer NOT NULL DEFAULT 0,
    155158    record_id serial NOT NULL,
    156159    host text DEFAULT '' NOT NULL,
     
    162165    ttl integer DEFAULT 7200 NOT NULL,
    163166    description text,
    164     location character varying (4) DEFAULT '' NOT NULL
    165 );
     167    rdns_id integer NOT NULL DEFAULT 0,
     168    location character varying (4) DEFAULT '' NOT NULL,
     169    stamp TIMESTAMP WITH TIME ZONE DEFAULT 'epoch' NOT NULL,
     170    expires boolean DEFAULT 'n' NOT NULL,
     171    stampactive boolean DEFAULT 'n' NOT NULL
     172);
     173CREATE INDEX rec_domain_index ON records USING btree (domain_id);
     174CREATE INDEX rec_revzone_index ON records USING btree (rdns_id);
     175CREATE INDEX rec_types_index ON records USING btree ("type");
    166176
    167177CREATE TABLE rectypes (
     
    309319    ADD CONSTRAINT "$1" FOREIGN KEY (group_id) REFERENCES groups(group_id);
    310320
     321ALTER TABLE ONLY default_records
     322    ADD CONSTRAINT "$1" FOREIGN KEY (group_id) REFERENCES groups(group_id);
     323
     324ALTER TABLE ONLY users
     325    ADD CONSTRAINT "$1" FOREIGN KEY (group_id) REFERENCES groups(group_id);
     326
    311327ALTER TABLE ONLY revzones
    312328    ADD CONSTRAINT "$1" FOREIGN KEY (group_id) REFERENCES groups(group_id);
    313329
    314 ALTER TABLE ONLY default_records
    315     ADD CONSTRAINT "$1" FOREIGN KEY (group_id) REFERENCES groups(group_id);
    316 
    317 ALTER TABLE ONLY users
    318     ADD CONSTRAINT "$1" FOREIGN KEY (group_id) REFERENCES groups(group_id);
    319 
    320330ALTER TABLE ONLY groups
    321331    ADD CONSTRAINT group_parent FOREIGN KEY (parent_group_id) REFERENCES groups(group_id);
    322332
    323333-- set starting sequence numbers, since we've inserted data before they're active
    324 SELECT pg_catalog.setval('misc_misc_id_seq', 2, false);
    325 SELECT pg_catalog.setval('default_records_record_id_seq', 8, false);
    326 SELECT pg_catalog.setval('default_rev_records_record_id_seq', 5, false);
    327 SELECT pg_catalog.setval('domains_domain_id_seq', 1, false);
    328 SELECT pg_catalog.setval('groups_group_id_seq', 2, false);
    329 SELECT pg_catalog.setval('permissions_permission_id_seq', 3, false);
    330 SELECT pg_catalog.setval('records_record_id_seq', 1, false);
    331 SELECT pg_catalog.setval('users_user_id_seq', 2, false);
     334-- only set the ones that have data loaded with \copy, and obey the convention
     335-- that comes out of pg_dump
     336SELECT pg_catalog.setval('misc_misc_id_seq', 1, true);
     337SELECT pg_catalog.setval('default_records_record_id_seq', 8, true);
     338SELECT pg_catalog.setval('default_rev_records_record_id_seq', 4, true);
     339SELECT pg_catalog.setval('groups_group_id_seq', 1, true);
     340SELECT pg_catalog.setval('permissions_permission_id_seq', 2, true);
     341SELECT pg_catalog.setval('users_user_id_seq', 1, true);
Note: See TracChangeset for help on using the changeset viewer.