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

fixed up domaindb.sql

parent 873fd835
-- TODO why?
delimiter //
DROP TABLE IF EXISTS keys;//
DROP TABLE IF EXISTS dkeys;//
DROP TABLE IF EXISTS subdomain;//
DROP TABLE IF EXISTS domain;//
DROP TABLE IF EXISTS person;//
DROP TABLE IF EXISTS record_types;//
create table person
(
......@@ -23,7 +25,7 @@ create table domain
CONSTRAINT pk_domain_id PRIMARY KEY (id),
CONSTRAINT fk_domain_perid FOREIGN KEY (personid) REFERENCES person(id)
)ENGINE=InnoDB;//
create table subdomain
......@@ -41,14 +43,30 @@ create table subdomain
)ENGINE=InnoDB;//
create table keys
-- dkey really should be key, but that's a reserver SQL keyword
create table dkeys
(
id int(11) NOT NULL AUTO_INCREMENT,
domainid int(11),
key varchar(255),
dkey varchar(255),
secret varchar(255),
CONSTRAINT pk_keys_id PRIMARY KEY (id),
CONSTRAINT fk_keys_domid FOREIGN KEY (domainid) REFERENCES domain(id)
CONSTRAINT pk_dkeys_id PRIMARY KEY (id),
CONSTRAINT fk_dkeys_domid FOREIGN KEY (domainid) REFERENCES domain(id)
)ENGINE=InnoDB;//
-- This table is used as an enum table
CREATE TABLE record_types
(
id int(11) NOT NULL AUTO_INCREMENT,
name varchar (16) NOT NULL,
CONSTRAINT pk_record_types_id PRIMARY KEY (id),
CONSTRAINT uc_record_types_name UNIQUE (name)
)ENGINE=InnoDB;//
-- Insert intial values.
-- Should probably be moved somewhere else
INSERT INTO record_types (name) VALUES ("A"), ("AAAA");
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