-
Notifications
You must be signed in to change notification settings - Fork 2
/
schema.sql
74 lines (59 loc) · 1.58 KB
/
schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
-- Created from schema.php, DO NOT EDIT DIRECTLY!
-- To regenerate: GEN_SQL=1 php schema.php > schemal.xml
drop table if exists users;
create table users (
id SERIAL PRIMARY KEY,
/**uuid uuid DEFAULT uuid_generate_v4 (),**/
username varchar(54) UNIQUE,
passwordhash varchar
);
drop table if exists components;
create table components (
id SERIAL PRIMARY KEY,
name varchar,
UNIQUE(name)
);
drop table if exists movements;
create table movements (
id SERIAL PRIMARY KEY,
userId integer,
type_ varchar(54), /* 'invoice', 'payment', 'worked' */
fromComponent integer,
toComponent integer,
timestamp_ timestamp,
amount decimal
);
drop table if exists statements;
create table statements (
id SERIAL PRIMARY KEY,
movementId integer,
userId integer,
sourceDocumentFormat varchar, /* could be an invoice, bank statement csv file, API call etc */
sourceDocumentFilename varchar, /* makes sourceDocumentContents unnecessary */
sourceDocumentContents varchar, /* makes sourceDocumentFilename unnecessary */
timestamp_ timestamp,
description varchar,
internal_type varchar,
remote_id varchar,
UNIQUE(remote_id),
remote_system varchar
);
drop table if exists componentGrants;
create table componentGrants (
id SERIAL PRIMARY KEY,
fromUser numeric,
toUser numeric,
componentId numeric
);
drop table if exists accessControl;
create table accessControl (
id SERIAL PRIMARY KEY,
componentId numeric UNIQUE,
userId numeric
);
drop table if exists commandLog;
create table commandLog (
id SERIAL PRIMARY KEY,
contextJson varchar,
commandJson varchar
);