Commit 2232866a authored by Hugo Hörnquist's avatar Hugo Hörnquist
Browse files

Database changes.

Remove dirty- and deletebit from database, along with their indices and
constraints. Also add on delete cascade for update_key, and sets some
new indices.
parent 22686e68
......@@ -23,14 +23,8 @@ CREATE TABLE domain
name varchar(191), -- hornquist.se
uid int(11), -- 2278
dirtybit bool NOT NULL DEFAULT 0,
deletebit bool NOT NULL DEFAULT 0,
CONSTRAINT pk_domain_id PRIMARY KEY (id),
CONSTRAINT uc_domain_name UNIQUE (name),
INDEX idx_domain_dirtybit (dirtybit),
INDEX idx_domain_deletebit (deletebit)
CONSTRAINT uc_domain_name UNIQUE (name)
)ENGINE=InnoDB;//
CREATE TABLE subdomain
......@@ -44,16 +38,14 @@ CREATE TABLE subdomain
domainid int(11),
dirtybit bool NOT NULL DEFAULT 0,
deletebit bool NOT NULL DEFAULT 0,
CONSTRAINT pk_subdomain_id PRIMARY KEY (id),
CONSTRAINT fk_subdomain_domid FOREIGN KEY (domainid) REFERENCES domain(id)
CONSTRAINT fk_subdomain_domid FOREIGN KEY (domainid)
REFERENCES domain(id)
ON DELETE CASCADE,
CONSTRAINT fk_subdomain_rr FOREIGN KEY (rr) REFERENCES record_types (id),
CONSTRAINT fk_subdomain_rr FOREIGN KEY (rr)
REFERENCES record_types (id),
CONSTRAINT uc_subdomain_name_domainid UNIQUE (name, domainid),
INDEX idx_subdomain_dirtybit (dirtybit),
INDEX idx_subdomain_deletebit (deletebit)
INDEX idx_subdomain_domainid (domainid)
)ENGINE=InnoDB;//
......@@ -66,7 +58,10 @@ CREATE TABLE update_key
secret varchar(255) NOT NULL,
CONSTRAINT pk_update_key_id PRIMARY KEY (id),
CONSTRAINT fk_update_key_subid FOREIGN KEY (subid) REFERENCES subdomain (id)
CONSTRAINT fk_update_key_subid FOREIGN KEY (subid)
REFERENCES subdomain (id)
ON DELETE CASCADE,
CONSTRAINT uc_update_key_subid UNIQUE (subid)
)ENGINE=InnoDB;//
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment