CREATE TABLE users (
id serial unique,
username varchar(32) not null unique,
password varchar(256) not null default 'x',
name text not null,
ctime timestamp not null default now()
);
CREATE TABLE addresses (
id serial unique,
ref_name text not null,
ip inet not null unique,
notes text
);
CREATE TABLE clients (
id serial unique,
ref_number integer,
username varchar(32) not null,
password varchar(256) not null,
name text not null,
address text,
email text not null
);
CREATE TABLE domains (
id serial unique,
owner integer references clients (id) on update cascade on delete set null,
domain text not null unique,
local_dns boolean not null default 't',
slave_dns boolean not null default 'f',
dynamic_dns boolean not null default 'f',
master_server inet
);
CREATE TABLE apache_hosts (
id serial unique,
owner integer references clients (id) on update cascade on delete set null,
hostname text not null unique,
documentroot text not null,
nossl boolean not null default 't',
ssl boolean not null default 'f',
);