-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.sql
166 lines (142 loc) · 4.16 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
create table accounts (
id bigserial not null,
created timestamp without time zone,
permissions text,
updated timestamp without time zone,
name text,
owner int8 not null,
primary key (id),
unique (name)
);
create table apps (
id bigserial not null,
created timestamp without time zone,
permissions text,
updated timestamp without time zone,
accountId int8 not null,
css text,
descr text,
js text,
keywords text,
logo text,
name text,
owner int8 not null,
template text,
theme text,
title text,
wrap text,
primary key (id),
unique (name)
);
create table audits (
id int8 not null,
pageName varchar(255),
request varchar(255),
timestamp timestamp,
username varchar(255),
primary key (id)
);
create table categories (
id bigserial not null,
created timestamp without time zone,
permissions text,
updated timestamp without time zone,
appId int8 not null,
name text,
ordered int4,
parentCategory bigint,
primary key (id),
unique (appId, name)
);
create table menus (
id bigserial not null,
created timestamp without time zone,
permissions text,
updated timestamp without time zone,
appId int8 not null,
name text,
ordered int4,
uri text,
parent bigint,
primary key (id),
unique (appId, name)
);
create table modules (
id bigserial not null,
created timestamp without time zone,
permissions text,
updated timestamp without time zone,
appId int8 not null,
content text,
data text,
descr text,
displayName text,
name text,
pages text,
type text,
primary key (id),
unique (appId, name)
);
create table pages (
id bigserial not null,
created timestamp without time zone,
permissions text,
updated timestamp without time zone,
appId int8 not null,
categoryId int8,
content text,
defaultPage bool not null,
title text,
type text,
url text,
primary key (id),
unique (appId, url)
);
create table users (
id bigserial not null,
created timestamp without time zone,
permissions text,
updated timestamp without time zone,
accountId int8 not null,
address text,
admin bool not null,
city text,
country text,
email text not null,
firstname text not null,
lastLoginAdmin timestamp without time zone,
lastLoginUser timestamp without time zone,
lastname text not null,
name text not null,
pass text not null,
phone text,
privileges varchar(255),
token text,
zip text,
primary key (id),
unique (token),
unique (accountId, email),
unique (accountId, name)
);
create index account_name_index on accounts (name);
create index app_name_index on apps (name);
create index app_account_index on apps (accountId);
create index category_app_index on categories (appId);
alter table categories
add constraint FK4D47461C8A0CE329
foreign key (parentCategory)
references categories;
create index menu_app_index on menus (appId);
alter table menus
add constraint FK62F96F461F8820C
foreign key (parent)
references menus;
create index module_app_index on modules (appId);
create index module_name_index on modules (name);
create index page_app_index on pages (appId);
create index page_category_index on pages (categoryId);
create index page_url_index on pages (url);
create index user_name_index on users (name);
create index user_email_index on users (email);
create index user_account_index on users (accountId);
create sequence hibernate_sequence;