2020-03-27 12:17:27 +01:00
|
|
|
CREATE EXTENSION "uuid-ossp";
|
|
|
|
|
2020-04-01 13:29:43 +02:00
|
|
|
CREATE TYPE "ProjectCategoryType" as ENUM (
|
2020-03-27 12:17:27 +01:00
|
|
|
'software',
|
|
|
|
'marketing',
|
|
|
|
'business'
|
|
|
|
);
|
|
|
|
|
2020-04-01 13:29:43 +02:00
|
|
|
CREATE TYPE "IssuePriorityType" as ENUM (
|
|
|
|
'highest',
|
|
|
|
'high',
|
|
|
|
'medium',
|
|
|
|
'low',
|
|
|
|
'lowest'
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TYPE "IssueTypeType" AS ENUM (
|
|
|
|
'task',
|
|
|
|
'bug',
|
|
|
|
'story'
|
|
|
|
);
|
|
|
|
|
2020-03-27 12:17:27 +01:00
|
|
|
CREATE TABLE projects (
|
|
|
|
id serial primary key not null,
|
|
|
|
name text not null,
|
|
|
|
url text not null default '',
|
|
|
|
description text not null default '',
|
|
|
|
category text not null default 'software',
|
|
|
|
created_at timestamp not null default now(),
|
|
|
|
updated_at timestamp not null default now()
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE users (
|
|
|
|
id serial primary key not null,
|
|
|
|
name text not null,
|
|
|
|
email text not null,
|
|
|
|
avatar_url text,
|
|
|
|
project_id integer not null references projects (id),
|
|
|
|
created_at timestamp not null default now(),
|
|
|
|
updated_at timestamp not null default now()
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE issues (
|
|
|
|
id serial primary key not null,
|
|
|
|
title text not null,
|
2020-04-01 13:29:43 +02:00
|
|
|
issue_type "IssueTypeType" not null,
|
2020-03-27 12:17:27 +01:00
|
|
|
status text not null,
|
2020-04-01 13:29:43 +02:00
|
|
|
priority "IssuePriorityType" not null,
|
2020-03-27 12:17:27 +01:00
|
|
|
list_position double precision not null default 0,
|
|
|
|
description text,
|
|
|
|
description_text text,
|
|
|
|
estimate integer,
|
|
|
|
time_spent integer,
|
|
|
|
time_remaining integer,
|
|
|
|
reporter_id integer not null references users (id),
|
|
|
|
project_id integer not null references projects (id),
|
|
|
|
created_at timestamp not null default now(),
|
|
|
|
updated_at timestamp not null default now()
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE comments (
|
|
|
|
id serial primary key not null,
|
|
|
|
body text not null,
|
|
|
|
user_id integer not null references users (id),
|
|
|
|
issue_id integer not null references issues (id),
|
|
|
|
created_at timestamp not null default now(),
|
|
|
|
updated_at timestamp not null default now()
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE tokens (
|
|
|
|
id serial primary key not null,
|
|
|
|
user_id integer not null references users (id),
|
|
|
|
access_token uuid not null,
|
|
|
|
refresh_token uuid not null,
|
|
|
|
created_at timestamp not null default now(),
|
|
|
|
updated_at timestamp not null default now()
|
|
|
|
);
|