setup/postgres/psql_create_tables.sql

Sat, 30 May 2020 18:07:41 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 30 May 2020 18:07:41 +0200
changeset 84
5407d4ea0611
parent 81
1a2e7b5d48f7
child 85
3d16ad54b3dc
permissions
-rw-r--r--

removes version statistics from version editor

-- This script creates the module management tables
--

create table lpit_user (
    userid          serial          primary key,
    username        varchar(50)     not null unique,
    mail            varchar(50),
    lastname        varchar(50),
    givenname       varchar(50)
);

create table lpit_project (
    projectid       serial          primary key,
    name            varchar(20)     not null unique,
    description     varchar(200),
    repoUrl         varchar(50),
    owner           integer         references lpit_user(userid)
);

create type version_status as enum (
    'Future',
    'Unreleased',
    'Released',
    'LTS',
    'Deprecated'
);

create table lpit_version (
    versionid       serial          primary key,
    project         integer         not null references lpit_project(projectid),
    name            varchar(20)     not null,
    ordinal         integer         not null default 0,
    status          version_status  not null default 'Future'
);

create type issue_status as enum (
    'InSpecification',
    'ToDo',
    'Scheduled',
    'InProgress',
    'InReview',
    'Done',
    'Rejected',
    'Withdrawn',
    'Duplicate'
);

create type issue_category as enum (
    'Feature',
    'Improvement',
    'Bug',
    'Task',
    'Test'
);

create table lpit_issue_phases (
    status          issue_status    primary key,
    phase           integer         not null
);

create table lpit_issue (
    issueid         serial          primary key,
    project         integer         not null references lpit_project(projectid),
    status          issue_status    not null default 'InSpecification',
    category        issue_category  not null default 'Feature',
    subject         varchar(20)     not null,
    description     text,
    assignee        integer         references lpit_user(userid),
    created         timestamp       with time zone not null default now(),
    updated         timestamp       with time zone not null default now(),
    eta             date
);

create table lpit_issue_affected_version (
    issueid         integer         references lpit_issue(issueid),
    versionid       integer         references lpit_version(versionid),
    primary key (issueid, versionid)
);

create table lpit_issue_scheduled_version (
    issueid         integer         references lpit_issue(issueid),
    versionid       integer         references lpit_version(versionid),
    primary key (issueid, versionid)
);

create table lpit_issue_resolved_version (
    issueid         integer         references lpit_issue(issueid),
    versionid       integer         references lpit_version(versionid),
    primary key (issueid, versionid)
);

mercurial