Changeset 545 for branches/stable/dns-1.0-1.2.sql
- Timestamp:
- 12/10/13 17:47:44 (10 years ago)
- Location:
- branches/stable
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/stable
- Property svn:mergeinfo changed
/trunk merged: 264-316,318-416
- Property svn:mergeinfo changed
-
branches/stable/dns-1.0-1.2.sql
r365 r545 1 1 -- SQL table/record type upgrade file for dnsadmin 1.0 to 1.2 migration 2 3 -- need this before we add any other bits 4 CREATE TABLE locations ( 5 location character varying (4) PRIMARY KEY, 6 loc_id serial UNIQUE, 7 group_id integer NOT NULL DEFAULT 1, 8 iplist text NOT NULL DEFAULT '', 9 description character varying(40) NOT NULL DEFAULT '', 10 comments text NOT NULL DEFAULT '' 11 ); 12 13 ALTER TABLE ONLY locations 14 ADD CONSTRAINT "locations_group_id_fkey" FOREIGN KEY (group_id) REFERENCES groups(group_id); 15 16 ALTER TABLE permissions ADD COLUMN record_locchg boolean DEFAULT false NOT NULL; 17 ALTER TABLE permissions ADD COLUMN location_create boolean DEFAULT false NOT NULL; 18 ALTER TABLE permissions ADD COLUMN location_edit boolean DEFAULT false NOT NULL; 19 ALTER TABLE permissions ADD COLUMN location_delete boolean DEFAULT false NOT NULL; 20 ALTER TABLE permissions ADD COLUMN location_view boolean DEFAULT false NOT NULL; 2 21 3 22 -- Minor buglet; domains must be unique … … 23 42 SELECT pg_catalog.setval('default_rev_records_record_id_seq', 5, false); 24 43 44 ALTER TABLE domains ADD COLUMN changed boolean DEFAULT true NOT NULL; 45 ALTER TABLE domains ADD COLUMN default_location character varying (4) DEFAULT '' NOT NULL; 46 -- ~2x performance boost iff most zones are fed to output from the cache 47 CREATE INDEX dom_status_index ON domains (status); 48 25 49 CREATE TABLE revzones ( 26 50 rdns_id serial NOT NULL, … … 30 54 status integer DEFAULT 1 NOT NULL, 31 55 zserial integer, 32 sertype character(1) DEFAULT 'D'::bpchar 56 sertype character(1) DEFAULT 'D'::bpchar, 57 changed boolean DEFAULT true NOT NULL, 58 default_location character varying (4) DEFAULT '' NOT NULL 33 59 ); 60 CREATE INDEX rev_status_index ON revzones (status); 61 62 ALTER TABLE ONLY revzones 63 ADD CONSTRAINT "$1" FOREIGN KEY (group_id) REFERENCES groups(group_id); 34 64 35 65 ALTER TABLE log ADD COLUMN rdns_id INTEGER; … … 40 70 ALTER TABLE records DROP CONSTRAINT "$1"; 41 71 ALTER TABLE records ALTER COLUMN domain_id SET DEFAULT 0; 42 ALTER TABLE records ADD COLUMN rdns_id INTEGER DEFAULT 0; 43 UPDATE records SET rdns_id=0; 44 ALTER TABLE records ALTER COLUMN rdns_id SET NOT NULL; 72 ALTER TABLE records ADD COLUMN rdns_id INTEGER DEFAULT 0 NOT NULL; 73 ALTER TABLE records ADD COLUMN location character varying (4) DEFAULT '' NOT NULL; 74 75 -- ~120s -> 75s performance boost on 100K records when always exporting all records 76 CREATE INDEX rec_types_index ON records (type); 77 -- Further ~1/3 performance gain, same dataset 78 CREATE INDEX rec_domain_index ON records (domain_id); 79 CREATE INDEX rec_revzone_index ON records (rdns_id); 45 80 46 81 -- May as well drop and recreate; this is nominally static and loaded from the
Note:
See TracChangeset
for help on using the changeset viewer.