setup/postgres/psql_create_tables.sql

Thu, 15 Oct 2020 12:27:05 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 15 Oct 2020 12:27:05 +0200
changeset 127
6105ee2cceaf
parent 124
ed2e7aef2a3e
child 128
947d0f6a6a83
permissions
-rw-r--r--

adds component entity

20
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 16
diff changeset
1 -- This script creates the module management tables
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 16
diff changeset
2 --
2
fcb452578142 adds create database setup script
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3
37
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
4 create table lpit_user (
20
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 16
diff changeset
5 userid serial primary key,
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 16
diff changeset
6 username varchar(50) not null unique,
37
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
7 mail varchar(50),
20
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 16
diff changeset
8 lastname varchar(50),
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 16
diff changeset
9 givenname varchar(50)
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 16
diff changeset
10 );
37
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
11
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
12 create table lpit_project (
75
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
13 projectid serial primary key,
37
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
14 name varchar(20) not null unique,
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
15 description varchar(200),
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
16 repoUrl varchar(50),
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
17 owner integer references lpit_user(userid)
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
18 );
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
19
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
20 create type version_status as enum (
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
21 'Future',
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
22 'Unreleased',
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
23 'Released',
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
24 'LTS',
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
25 'Deprecated'
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
26 );
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
27
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
28 create table lpit_version (
75
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
29 versionid serial primary key,
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
30 project integer not null references lpit_project(projectid),
37
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
31 name varchar(20) not null,
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
32 ordinal integer not null default 0,
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
33 status version_status not null default 'Future'
fecda0f466e6 adds data model for projects and versions
Mike Becker <universe@uap-core.de>
parents: 36
diff changeset
34 );
62
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
35
127
6105ee2cceaf adds component entity
Mike Becker <universe@uap-core.de>
parents: 124
diff changeset
36
6105ee2cceaf adds component entity
Mike Becker <universe@uap-core.de>
parents: 124
diff changeset
37 create table lpit_component (
6105ee2cceaf adds component entity
Mike Becker <universe@uap-core.de>
parents: 124
diff changeset
38 id serial primary key,
6105ee2cceaf adds component entity
Mike Becker <universe@uap-core.de>
parents: 124
diff changeset
39 project integer not null references lpit_project(projectid),
6105ee2cceaf adds component entity
Mike Becker <universe@uap-core.de>
parents: 124
diff changeset
40 name varchar(20) not null,
6105ee2cceaf adds component entity
Mike Becker <universe@uap-core.de>
parents: 124
diff changeset
41 color char(6) not null default '000000',
6105ee2cceaf adds component entity
Mike Becker <universe@uap-core.de>
parents: 124
diff changeset
42 ordinal integer not null default 0,
6105ee2cceaf adds component entity
Mike Becker <universe@uap-core.de>
parents: 124
diff changeset
43 description text
6105ee2cceaf adds component entity
Mike Becker <universe@uap-core.de>
parents: 124
diff changeset
44 );
6105ee2cceaf adds component entity
Mike Becker <universe@uap-core.de>
parents: 124
diff changeset
45
62
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
46 create type issue_status as enum (
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
47 'InSpecification',
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
48 'ToDo',
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
49 'Scheduled',
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
50 'InProgress',
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
51 'InReview',
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
52 'Done',
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
53 'Rejected',
81
1a2e7b5d48f7 adds issue summaries
Mike Becker <universe@uap-core.de>
parents: 75
diff changeset
54 'Withdrawn',
1a2e7b5d48f7 adds issue summaries
Mike Becker <universe@uap-core.de>
parents: 75
diff changeset
55 'Duplicate'
62
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
56 );
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
57
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
58 create type issue_category as enum (
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
59 'Feature',
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
60 'Improvement',
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
61 'Bug',
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
62 'Task',
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
63 'Test'
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
64 );
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
65
81
1a2e7b5d48f7 adds issue summaries
Mike Becker <universe@uap-core.de>
parents: 75
diff changeset
66 create table lpit_issue_phases (
1a2e7b5d48f7 adds issue summaries
Mike Becker <universe@uap-core.de>
parents: 75
diff changeset
67 status issue_status primary key,
1a2e7b5d48f7 adds issue summaries
Mike Becker <universe@uap-core.de>
parents: 75
diff changeset
68 phase integer not null
1a2e7b5d48f7 adds issue summaries
Mike Becker <universe@uap-core.de>
parents: 75
diff changeset
69 );
1a2e7b5d48f7 adds issue summaries
Mike Becker <universe@uap-core.de>
parents: 75
diff changeset
70
62
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
71 create table lpit_issue (
75
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
72 issueid serial primary key,
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
73 project integer not null references lpit_project(projectid),
127
6105ee2cceaf adds component entity
Mike Becker <universe@uap-core.de>
parents: 124
diff changeset
74 component integer references lpit_component(id),
62
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
75 status issue_status not null default 'InSpecification',
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
76 category issue_category not null default 'Feature',
85
3d16ad54b3dc significantly increases length of subject field
Mike Becker <universe@uap-core.de>
parents: 81
diff changeset
77 subject varchar(200) not null,
62
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
78 description text,
75
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
79 assignee integer references lpit_user(userid),
62
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
80 created timestamp with time zone not null default now(),
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
81 updated timestamp with time zone not null default now(),
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
82 eta date
833e0385572a adds data model for issues
Mike Becker <universe@uap-core.de>
parents: 37
diff changeset
83 );
75
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
84
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
85 create table lpit_issue_affected_version (
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
86 issueid integer references lpit_issue(issueid),
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
87 versionid integer references lpit_version(versionid),
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
88 primary key (issueid, versionid)
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
89 );
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
90
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
91 create table lpit_issue_resolved_version (
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
92 issueid integer references lpit_issue(issueid),
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
93 versionid integer references lpit_version(versionid),
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
94 primary key (issueid, versionid)
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
95 );
33b6843fdf8a adds the ability to create and edit issues
Mike Becker <universe@uap-core.de>
parents: 62
diff changeset
96
124
ed2e7aef2a3e adds issue comments
Mike Becker <universe@uap-core.de>
parents: 88
diff changeset
97 create table lpit_issue_comment (
ed2e7aef2a3e adds issue comments
Mike Becker <universe@uap-core.de>
parents: 88
diff changeset
98 commentid serial primary key,
ed2e7aef2a3e adds issue comments
Mike Becker <universe@uap-core.de>
parents: 88
diff changeset
99 issueid integer not null references lpit_issue(issueid),
ed2e7aef2a3e adds issue comments
Mike Becker <universe@uap-core.de>
parents: 88
diff changeset
100 userid integer references lpit_user(userid),
ed2e7aef2a3e adds issue comments
Mike Becker <universe@uap-core.de>
parents: 88
diff changeset
101 created timestamp with time zone not null default now(),
ed2e7aef2a3e adds issue comments
Mike Becker <universe@uap-core.de>
parents: 88
diff changeset
102 updated timestamp with time zone not null default now(),
ed2e7aef2a3e adds issue comments
Mike Becker <universe@uap-core.de>
parents: 88
diff changeset
103 updatecount integer not null default 0,
ed2e7aef2a3e adds issue comments
Mike Becker <universe@uap-core.de>
parents: 88
diff changeset
104 comment text not null
ed2e7aef2a3e adds issue comments
Mike Becker <universe@uap-core.de>
parents: 88
diff changeset
105 );

mercurial