Sat, 15 Jul 2023 13:49:36 +0200
Added tag v1.0.1 for changeset 6971db7b18ab
1 -- This script creates the module management tables
2 --
4 create table lpit_user
5 (
6 userid serial primary key,
7 username text not null unique,
8 mail text,
9 lastname text,
10 givenname text
11 );
13 create table lpit_project
14 (
15 projectid serial primary key,
16 name text not null unique,
17 node text not null unique,
18 ordinal integer not null default 0,
19 description text,
20 repoUrl text,
21 owner integer references lpit_user (userid)
22 );
24 create type version_status as enum (
25 'Future',
26 'Unreleased',
27 'Released',
28 'LTS',
29 'Deprecated'
30 );
32 create table lpit_version
33 (
34 versionid serial primary key,
35 project integer not null references lpit_project (projectid),
36 name text not null,
37 node text not null,
38 ordinal integer not null default 0,
39 status version_status not null default 'Future',
40 release date,
41 eol date
42 );
44 create unique index lpit_version_node_unique on lpit_version (project, node);
46 create table lpit_component
47 (
48 id serial primary key,
49 project integer not null references lpit_project (projectid),
50 name text not null,
51 node text not null,
52 color char(6) not null default '000000',
53 ordinal integer not null default 0,
54 description text,
55 lead integer references lpit_user (userid),
56 active boolean not null default true
57 );
59 create unique index lpit_component_node_unique on lpit_component (project, node);
61 create type issue_status as enum (
62 'InSpecification',
63 'ToDo',
64 'Scheduled',
65 'InProgress',
66 'InReview',
67 'Ready',
68 'Done',
69 'Rejected',
70 'Withdrawn',
71 'Duplicate'
72 );
74 create type issue_category as enum (
75 'Feature',
76 'Improvement',
77 'Bug',
78 'Task',
79 'Test'
80 );
82 create table lpit_issue_phases
83 (
84 status issue_status primary key,
85 phase integer not null
86 );
88 create table lpit_issue
89 (
90 issueid serial primary key,
91 project integer not null references lpit_project (projectid),
92 component integer references lpit_component (id),
93 status issue_status not null default 'InSpecification',
94 category issue_category not null default 'Feature',
95 subject text not null,
96 description text,
97 assignee integer references lpit_user (userid),
98 created timestamp with time zone not null default now(),
99 updated timestamp with time zone not null default now(),
100 eta date,
101 affected integer references lpit_version (versionid),
102 resolved integer references lpit_version (versionid)
103 );
105 create type issue_history_event as enum (
106 'New',
107 'Update',
108 'NewComment',
109 'UpdateComment'
110 );
112 create table lpit_issue_history_event
113 (
114 eventid serial primary key,
115 issueid integer not null references lpit_issue (issueid) on delete cascade,
116 subject text not null,
117 time timestamp with time zone not null default now(),
118 type issue_history_event not null
119 );
121 create table lpit_issue_history_data
122 (
123 eventid integer not null references lpit_issue_history_event (eventid) on delete cascade,
124 component text,
125 status issue_status not null,
126 category issue_category not null,
127 description text,
128 assignee text,
129 eta date,
130 affected text,
131 resolved text
132 );
134 create table lpit_issue_comment
135 (
136 commentid serial primary key,
137 issueid integer not null references lpit_issue (issueid),
138 userid integer references lpit_user (userid),
139 created timestamp with time zone not null default now(),
140 updated timestamp with time zone not null default now(),
141 updatecount integer not null default 0,
142 comment text not null
143 );
145 create table lpit_issue_comment_history
146 (
147 commentid integer not null references lpit_issue_comment (commentid) on delete cascade,
148 eventid integer not null references lpit_issue_history_event (eventid) on delete cascade,
149 comment text not null
150 );
152 create type relation_type as enum (
153 'RelatesTo',
154 'TogetherWith',
155 'Before',
156 'SubtaskOf',
157 'DefectOf',
158 'Blocks',
159 'Tests',
160 'Duplicates'
161 );
163 create table lpit_issue_relation
164 (
165 from_issue integer not null references lpit_issue (issueid) on delete cascade,
166 to_issue integer not null references lpit_issue (issueid) on delete cascade,
167 type relation_type not null
168 );
170 create unique index lpit_issue_relation_unique on lpit_issue_relation (from_issue, to_issue, type);