You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
3.4 KiB
75 lines
3.4 KiB
CREATE EXTENSION IF NOT EXISTS citext;
|
|
|
|
CREATE TABLE person (
|
|
id serial PRIMARY KEY,
|
|
name text not null,
|
|
email citext not null unique,
|
|
is_enabled boolean not null default true,
|
|
is_admin boolean not null default false,
|
|
created_at timestamptz not null default current_timestamp
|
|
);
|
|
|
|
-- Settings for a given user. | Use with care, add things to the data model when you should.
|
|
CREATE TABLE person_settings (
|
|
id serial PRIMARY KEY,
|
|
person_id int not null references person(id),
|
|
name text not null,
|
|
value json not null default '{}',
|
|
created_at timestamptz not null default current_timestamp,
|
|
|
|
-- Allow ->find_or_new_related()
|
|
CONSTRAINT unq_person_id_name UNIQUE(person_id, name)
|
|
);
|
|
|
|
CREATE TABLE auth_password (
|
|
person_id int not null unique references person(id),
|
|
password text not null,
|
|
salt text not null,
|
|
updated_at timestamptz not null default current_timestamp,
|
|
created_at timestamptz not null default current_timestamp
|
|
);
|
|
|
|
CREATE TABLE auth_token (
|
|
id serial PRIMARY KEY,
|
|
person_id int not null references person(id),
|
|
scope text not null,
|
|
token text not null,
|
|
created_at timestamptz not null default current_timestamp
|
|
);
|
|
|
|
CREATE TABLE domain (
|
|
id serial PRIMARY KEY,
|
|
person_id int not null references person(id),
|
|
name citext not null unique,
|
|
created_at timestamptz not null default current_timestamp
|
|
);
|
|
|
|
CREATE TABLE blog (
|
|
id serial PRIMARY KEY,
|
|
person_id int not null references person(id),
|
|
domain_id int references domain(id),
|
|
|
|
-- Settings: File Allowances
|
|
max_static_file_count int not null default 100,
|
|
max_static_file_size int not null default 5, -- MiB
|
|
max_static_webroot_size int not null default 50, -- MiB
|
|
|
|
-- Settings: Build Timers
|
|
minutes_wait_after_build int not null default 10,
|
|
builds_per_hour int not null default 3,
|
|
builds_per_day int not null default 12,
|
|
|
|
-- Settings: Features
|
|
build_priority int not null default 1,
|
|
|
|
is_enabled boolean not null default true,
|
|
created_at timestamptz not null default current_timestamp
|
|
);
|
|
|
|
CREATE TABLE build (
|
|
id serial PRIMARY KEY,
|
|
blog_id int not null references blog(id),
|
|
job_id int not null, -- For minion->job($id)
|
|
created_at timestamptz not null default current_timestamp
|
|
);
|
|
|
|
|