소스 검색

.env example; sql scripts

tags/0.1.0
Robin Thoni 9 년 전
부모
커밋
8db90e39ae
3개의 변경된 파일1073개의 추가작업 그리고 0개의 파일을 삭제
  1. 9
    0
      example.env
  2. 365
    0
      sql/data_init.sql
  3. 699
    0
      sql/struct_init.sql

+ 9
- 0
example.env 파일 보기

@@ -0,0 +1,9 @@
1
+DB_CONNECTION=pgsql
2
+DB_HOST=localhost
3
+DB_PORT=5432
4
+DB_DATABASE=camotion
5
+DB_USERNAME=dev
6
+DB_PASSWORD=dev
7
+
8
+MCRYPT_KEY=ffffffffffffffffffffffff
9
+JWT_KEY=ffffffffffffffffffffffffffffffffffffffff

+ 365
- 0
sql/data_init.sql 파일 보기

@@ -0,0 +1,365 @@
1
+--
2
+-- PostgreSQL database dump
3
+--
4
+--
5
+-- Data for Name: camera_types; Type: TABLE DATA; Schema: public; Owner: dev
6
+--
7
+
8
+INSERT INTO camera_types VALUES (3, 'Trendnet TV-IP311PI', 'App\Http\Business\Cameras\Trendnet\TVIP311PI', '{"Host": "http://camX.example.com","Port":6080, "Username": "user", "Password": "PA$$W0RD"}');
9
+INSERT INTO camera_types VALUES (1, 'Dummy', '\App\Http\Business\Cameras\DummyCamera', '{}');
10
+
11
+
12
+--
13
+-- Name: camera_types_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dev
14
+--
15
+
16
+SELECT pg_catalog.setval('camera_types_id_seq', 3, true);
17
+
18
+
19
+--
20
+-- Data for Name: hosts; Type: TABLE DATA; Schema: public; Owner: dev
21
+--
22
+
23
+INSERT INTO hosts VALUES (9, 'Test.', 'http://backend.camotion.local/', '');
24
+
25
+
26
+--
27
+-- Data for Name: cameras; Type: TABLE DATA; Schema: public; Owner: dev
28
+--
29
+
30
+INSERT INTO cameras VALUES (9, 'Test.', 'Test. description', 9, 1, '{}');
31
+INSERT INTO cameras VALUES (6, 'Test.2', 'Test.2 description', 9, 1, '{}');
32
+INSERT INTO cameras VALUES (7, 'Test.3', 'Test.3 description', 9, 1, '{}');
33
+INSERT INTO cameras VALUES (8, 'Test.4', 'Test.4 description', 9, 1, '{}');
34
+
35
+
36
+--
37
+-- Name: cameras_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dev
38
+--
39
+
40
+SELECT pg_catalog.setval('cameras_id_seq', 11, true);
41
+
42
+
43
+--
44
+-- Data for Name: command_types; Type: TABLE DATA; Schema: public; Owner: dev
45
+--
46
+
47
+INSERT INTO command_types VALUES (1, 'Dummy command', 'App\Http\Business\Commands\DummyCommand', '{"Success": true}');
48
+INSERT INTO command_types VALUES (2, 'Wake on LAN', 'App\Http\Business\Commands\WakeOnLanCommand', '{"IP": "255.255.255.255", "Port": 9, "MACs": ["ff:ff:ff:ff:ff:ff"]}');
49
+INSERT INTO command_types VALUES (3, 'PiFace Digital', 'App\Http\Business\Commands\PiFaceCommand', '{"Commands":["device=0","up=0", "sleep=500", "down=0"]}');
50
+
51
+
52
+--
53
+-- Name: command_types_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dev
54
+--
55
+
56
+SELECT pg_catalog.setval('command_types_id_seq', 3, true);
57
+
58
+
59
+--
60
+-- Data for Name: commands; Type: TABLE DATA; Schema: public; Owner: dev
61
+--
62
+
63
+INSERT INTO commands VALUES (1, 'Dummy command', 'Command that will fail', 9, 1, '{"Success":false}');
64
+INSERT INTO commands VALUES (2, 'Dummy command 2', 'Command that will succeed', 9, 1, '{"Success":true}');
65
+
66
+
67
+--
68
+-- Name: commands_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dev
69
+--
70
+
71
+SELECT pg_catalog.setval('commands_id_seq', 4, true);
72
+
73
+
74
+--
75
+-- Name: hosts_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dev
76
+--
77
+
78
+SELECT pg_catalog.setval('hosts_id_seq', 10, true);
79
+
80
+
81
+--
82
+-- Data for Name: luticate_groups; Type: TABLE DATA; Schema: public; Owner: dev
83
+--
84
+
85
+INSERT INTO luticate_groups VALUES (0, 'Super Administrators');
86
+INSERT INTO luticate_groups VALUES (1, 'Administrators');
87
+INSERT INTO luticate_groups VALUES (3, 'Cameras');
88
+INSERT INTO luticate_groups VALUES (4, 'Sensors');
89
+INSERT INTO luticate_groups VALUES (5, 'Commands');
90
+
91
+
92
+--
93
+-- Name: luticate_groups_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dev
94
+--
95
+
96
+SELECT pg_catalog.setval('luticate_groups_id_seq', 5, true);
97
+
98
+
99
+--
100
+-- Data for Name: luticate_permissions; Type: TABLE DATA; Schema: public; Owner: dev
101
+--
102
+
103
+INSERT INTO luticate_permissions VALUES ('LU_USER_GET', false);
104
+INSERT INTO luticate_permissions VALUES ('LU_USER_SET_PASSWORD', false);
105
+INSERT INTO luticate_permissions VALUES ('LU_USER_LOGIN', true);
106
+INSERT INTO luticate_permissions VALUES ('LU_USER_EDIT_ME', true);
107
+INSERT INTO luticate_permissions VALUES ('LU_USER_SET_PASSWORD_ME', true);
108
+INSERT INTO luticate_permissions VALUES ('LU_GROUP_ADD', false);
109
+INSERT INTO luticate_permissions VALUES ('LU_GROUP_DEL', false);
110
+INSERT INTO luticate_permissions VALUES ('LU_GROUP_EDIT', false);
111
+INSERT INTO luticate_permissions VALUES ('LU_GROUP_USER_ADD', false);
112
+INSERT INTO luticate_permissions VALUES ('LU_GROUP_USER_DEL', false);
113
+INSERT INTO luticate_permissions VALUES ('LU_PERM_ADD', false);
114
+INSERT INTO luticate_permissions VALUES ('LU_PERM_DEL', false);
115
+INSERT INTO luticate_permissions VALUES ('LU_PERM_EDIT', false);
116
+INSERT INTO luticate_permissions VALUES ('LU_PERM_EFFECTIVE_GET', false);
117
+INSERT INTO luticate_permissions VALUES ('LU_PERM_GET', false);
118
+INSERT INTO luticate_permissions VALUES ('LU_PERM_GROUP_ADD', false);
119
+INSERT INTO luticate_permissions VALUES ('LU_PERM_GROUP_DEL', false);
120
+INSERT INTO luticate_permissions VALUES ('LU_PERM_GROUP_EDIT', false);
121
+INSERT INTO luticate_permissions VALUES ('LU_PERM_GROUP_GET', false);
122
+INSERT INTO luticate_permissions VALUES ('LU_GROUP_GET', false);
123
+INSERT INTO luticate_permissions VALUES ('LU_PERM_USER_ADD', false);
124
+INSERT INTO luticate_permissions VALUES ('LU_PERM_USER_DEL', false);
125
+INSERT INTO luticate_permissions VALUES ('LU_PERM_USER_EDIT', false);
126
+INSERT INTO luticate_permissions VALUES ('LU_USER_EDIT', false);
127
+INSERT INTO luticate_permissions VALUES ('LU_USER_DEL', false);
128
+INSERT INTO luticate_permissions VALUES ('LU_USER_ADD', false);
129
+INSERT INTO luticate_permissions VALUES ('LU_PERM_USER_GET', false);
130
+INSERT INTO luticate_permissions VALUES ('CAMOTION_HOST_ADD', false);
131
+INSERT INTO luticate_permissions VALUES ('CAMOTION_HOST_DEL', false);
132
+INSERT INTO luticate_permissions VALUES ('CAMOTION_HOST_EDIT', false);
133
+INSERT INTO luticate_permissions VALUES ('CAMOTION_COMMAND_ADD', false);
134
+INSERT INTO luticate_permissions VALUES ('CAMOTION_COMMAND_DEL', false);
135
+INSERT INTO luticate_permissions VALUES ('CAMOTION_COMMAND_EDIT', false);
136
+INSERT INTO luticate_permissions VALUES ('CAMOTION_SENSOR_ADD', false);
137
+INSERT INTO luticate_permissions VALUES ('CAMOTION_SENSOR_DEL', false);
138
+INSERT INTO luticate_permissions VALUES ('CAMOTION_SENSOR_EDIT', false);
139
+INSERT INTO luticate_permissions VALUES ('CAMOTION_CAMERA_ADD', false);
140
+INSERT INTO luticate_permissions VALUES ('CAMOTION_CAMERA_DEL', false);
141
+INSERT INTO luticate_permissions VALUES ('CAMOTION_CAMERA_EDIT', false);
142
+INSERT INTO luticate_permissions VALUES ('CAMOTION_SENSOR_EXEC', false);
143
+INSERT INTO luticate_permissions VALUES ('CAMOTION_SENSOR_GET', false);
144
+INSERT INTO luticate_permissions VALUES ('CAMOTION_CAMERA_EXEC', false);
145
+INSERT INTO luticate_permissions VALUES ('CAMOTION_CAMERA_GET', false);
146
+INSERT INTO luticate_permissions VALUES ('CAMOTION_COMMAND_EXEC', false);
147
+INSERT INTO luticate_permissions VALUES ('CAMOTION_COMMAND_GET', false);
148
+INSERT INTO luticate_permissions VALUES ('CAMOTION_HOST_GET', false);
149
+
150
+
151
+--
152
+-- Data for Name: luticate_permissions_groups; Type: TABLE DATA; Schema: public; Owner: dev
153
+--
154
+
155
+INSERT INTO luticate_permissions_groups VALUES ('LU_GROUP_ADD', true, 0);
156
+INSERT INTO luticate_permissions_groups VALUES ('LU_GROUP_DEL', true, 0);
157
+INSERT INTO luticate_permissions_groups VALUES ('LU_GROUP_EDIT', true, 0);
158
+INSERT INTO luticate_permissions_groups VALUES ('LU_GROUP_GET', true, 0);
159
+INSERT INTO luticate_permissions_groups VALUES ('LU_GROUP_USER_ADD', true, 0);
160
+INSERT INTO luticate_permissions_groups VALUES ('LU_GROUP_USER_DEL', true, 0);
161
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_EFFECTIVE_GET', true, 0);
162
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_GET', true, 0);
163
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_GROUP_ADD', true, 0);
164
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_GROUP_DEL', true, 0);
165
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_GROUP_EDIT', true, 0);
166
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_GROUP_GET', true, 0);
167
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_USER_ADD', true, 0);
168
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_USER_DEL', true, 0);
169
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_USER_EDIT', true, 0);
170
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_USER_GET', true, 0);
171
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_ADD', true, 0);
172
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_DEL', true, 0);
173
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_EDIT', true, 0);
174
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_EDIT_ME', true, 0);
175
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_GET', true, 0);
176
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_LOGIN', true, 0);
177
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_SET_PASSWORD', true, 0);
178
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_SET_PASSWORD_ME', true, 0);
179
+INSERT INTO luticate_permissions_groups VALUES ('LU_GROUP_ADD', true, 1);
180
+INSERT INTO luticate_permissions_groups VALUES ('LU_GROUP_DEL', true, 1);
181
+INSERT INTO luticate_permissions_groups VALUES ('LU_GROUP_EDIT', true, 1);
182
+INSERT INTO luticate_permissions_groups VALUES ('LU_GROUP_GET', true, 1);
183
+INSERT INTO luticate_permissions_groups VALUES ('LU_GROUP_USER_ADD', true, 1);
184
+INSERT INTO luticate_permissions_groups VALUES ('LU_GROUP_USER_DEL', true, 1);
185
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_EFFECTIVE_GET', true, 1);
186
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_GET', true, 1);
187
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_GROUP_ADD', true, 1);
188
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_GROUP_DEL', true, 1);
189
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_GROUP_EDIT', true, 1);
190
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_GROUP_GET', true, 1);
191
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_USER_ADD', true, 1);
192
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_USER_DEL', true, 1);
193
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_USER_EDIT', true, 1);
194
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_USER_GET', true, 1);
195
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_ADD', true, 1);
196
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_DEL', true, 1);
197
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_EDIT', true, 1);
198
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_EDIT_ME', true, 1);
199
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_GET', true, 1);
200
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_LOGIN', true, 1);
201
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_SET_PASSWORD', true, 1);
202
+INSERT INTO luticate_permissions_groups VALUES ('LU_USER_SET_PASSWORD_ME', true, 1);
203
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_EDIT', true, 0);
204
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_DEL', true, 0);
205
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_ADD', true, 0);
206
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_ADD', false, 1);
207
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_EDIT', false, 1);
208
+INSERT INTO luticate_permissions_groups VALUES ('LU_PERM_DEL', false, 1);
209
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_CAMERA_ADD', true, 1);
210
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_CAMERA_DEL', true, 1);
211
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_CAMERA_EDIT', true, 1);
212
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_CAMERA_EXEC', true, 1);
213
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_CAMERA_GET', true, 1);
214
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_COMMAND_ADD', true, 1);
215
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_COMMAND_DEL', true, 1);
216
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_COMMAND_EDIT', true, 1);
217
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_COMMAND_EXEC', true, 1);
218
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_COMMAND_GET', true, 1);
219
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_HOST_ADD', true, 1);
220
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_HOST_DEL', true, 1);
221
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_HOST_EDIT', true, 1);
222
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_HOST_GET', true, 1);
223
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_SENSOR_ADD', true, 1);
224
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_SENSOR_DEL', true, 1);
225
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_SENSOR_EDIT', true, 1);
226
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_SENSOR_EXEC', true, 1);
227
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_SENSOR_GET', true, 1);
228
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_CAMERA_ADD', true, 0);
229
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_CAMERA_DEL', true, 0);
230
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_CAMERA_EDIT', true, 0);
231
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_CAMERA_EXEC', true, 0);
232
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_CAMERA_GET', true, 0);
233
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_COMMAND_ADD', true, 0);
234
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_COMMAND_DEL', true, 0);
235
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_COMMAND_EDIT', true, 0);
236
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_COMMAND_EXEC', true, 0);
237
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_COMMAND_GET', true, 0);
238
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_HOST_ADD', true, 0);
239
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_HOST_DEL', true, 0);
240
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_HOST_EDIT', true, 0);
241
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_HOST_GET', true, 0);
242
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_SENSOR_ADD', true, 0);
243
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_SENSOR_DEL', true, 0);
244
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_SENSOR_EDIT', true, 0);
245
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_SENSOR_EXEC', true, 0);
246
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_SENSOR_GET', true, 0);
247
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_CAMERA_GET', true, 3);
248
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_CAMERA_EXEC', true, 3);
249
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_SENSOR_GET', true, 4);
250
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_SENSOR_EXEC', true, 4);
251
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_COMMAND_GET', true, 5);
252
+INSERT INTO luticate_permissions_groups VALUES ('CAMOTION_COMMAND_EXEC', true, 5);
253
+
254
+
255
+--
256
+-- Data for Name: luticate_users; Type: TABLE DATA; Schema: public; Owner: dev
257
+--
258
+
259
+INSERT INTO luticate_users VALUES (0, 'anonymous', 'anonymous@example.com', '', '', NULL, 'anonymous', 'anonymous');
260
+INSERT INTO luticate_users VALUES (1, 'root', 'root@example.com', '$2y$10$m1aN1a1ZEr1vmjFPfWl4Pu/63EhcxVCrC/DF0DFhdGbvORwtJtCmy', 'szHKcDk5v1', NULL, 'root', 'root');
261
+INSERT INTO luticate_users VALUES (4, 'user', 'uesr@example.com', '$2y$10$3aoyf68xWuL4/Rop1lAYDOaBTWeFyvX8H.lYBSZRH9HIwaFxhimDG', 'OqSvWHcjAB', NULL, 'User', 'User');
262
+
263
+
264
+--
265
+-- Data for Name: luticate_permissions_users; Type: TABLE DATA; Schema: public; Owner: dev
266
+--
267
+
268
+INSERT INTO luticate_permissions_users VALUES ('LU_GROUP_ADD', false, 0);
269
+INSERT INTO luticate_permissions_users VALUES ('LU_GROUP_DEL', false, 0);
270
+INSERT INTO luticate_permissions_users VALUES ('LU_GROUP_EDIT', false, 0);
271
+INSERT INTO luticate_permissions_users VALUES ('LU_GROUP_USER_ADD', false, 0);
272
+INSERT INTO luticate_permissions_users VALUES ('LU_GROUP_USER_DEL', false, 0);
273
+INSERT INTO luticate_permissions_users VALUES ('LU_PERM_ADD', false, 0);
274
+INSERT INTO luticate_permissions_users VALUES ('LU_PERM_DEL', false, 0);
275
+INSERT INTO luticate_permissions_users VALUES ('LU_PERM_EDIT', false, 0);
276
+INSERT INTO luticate_permissions_users VALUES ('LU_PERM_EFFECTIVE_GET', false, 0);
277
+INSERT INTO luticate_permissions_users VALUES ('LU_PERM_GET', false, 0);
278
+INSERT INTO luticate_permissions_users VALUES ('LU_PERM_GROUP_ADD', false, 0);
279
+INSERT INTO luticate_permissions_users VALUES ('LU_PERM_GROUP_DEL', false, 0);
280
+INSERT INTO luticate_permissions_users VALUES ('LU_PERM_GROUP_EDIT', false, 0);
281
+INSERT INTO luticate_permissions_users VALUES ('LU_PERM_GROUP_GET', false, 0);
282
+INSERT INTO luticate_permissions_users VALUES ('LU_PERM_USER_ADD', false, 0);
283
+INSERT INTO luticate_permissions_users VALUES ('LU_PERM_USER_DEL', false, 0);
284
+INSERT INTO luticate_permissions_users VALUES ('LU_PERM_USER_EDIT', false, 0);
285
+INSERT INTO luticate_permissions_users VALUES ('LU_PERM_USER_GET', false, 0);
286
+INSERT INTO luticate_permissions_users VALUES ('LU_USER_ADD', false, 0);
287
+INSERT INTO luticate_permissions_users VALUES ('LU_USER_DEL', false, 0);
288
+INSERT INTO luticate_permissions_users VALUES ('LU_USER_EDIT', false, 0);
289
+INSERT INTO luticate_permissions_users VALUES ('LU_USER_EDIT_ME', false, 0);
290
+INSERT INTO luticate_permissions_users VALUES ('LU_USER_GET', false, 0);
291
+INSERT INTO luticate_permissions_users VALUES ('LU_USER_SET_PASSWORD', false, 0);
292
+INSERT INTO luticate_permissions_users VALUES ('LU_USER_SET_PASSWORD_ME', false, 0);
293
+INSERT INTO luticate_permissions_users VALUES ('LU_USER_LOGIN', true, 0);
294
+INSERT INTO luticate_permissions_users VALUES ('LU_GROUP_GET', false, 0);
295
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_COMMAND_ADD', false, 0);
296
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_COMMAND_DEL', false, 0);
297
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_COMMAND_EDIT', false, 0);
298
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_COMMAND_EXEC', false, 0);
299
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_COMMAND_GET', false, 0);
300
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_SENSOR_ADD', false, 0);
301
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_SENSOR_DEL', false, 0);
302
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_SENSOR_EDIT', false, 0);
303
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_SENSOR_EXEC', false, 0);
304
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_SENSOR_GET', false, 0);
305
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_HOST_ADD', false, 0);
306
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_HOST_EDIT', false, 0);
307
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_HOST_DEL', false, 0);
308
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_HOST_GET', false, 0);
309
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_CAMERA_GET', false, 0);
310
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_CAMERA_EDIT', false, 0);
311
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_CAMERA_ADD', false, 0);
312
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_CAMERA_DEL', false, 0);
313
+INSERT INTO luticate_permissions_users VALUES ('CAMOTION_CAMERA_EXEC', false, 0);
314
+
315
+
316
+--
317
+-- Data for Name: luticate_users_groups; Type: TABLE DATA; Schema: public; Owner: dev
318
+--
319
+
320
+INSERT INTO luticate_users_groups VALUES (1, 0);
321
+INSERT INTO luticate_users_groups VALUES (4, 3);
322
+INSERT INTO luticate_users_groups VALUES (4, 5);
323
+INSERT INTO luticate_users_groups VALUES (4, 4);
324
+
325
+
326
+--
327
+-- Name: luticate_users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dev
328
+--
329
+
330
+SELECT pg_catalog.setval('luticate_users_id_seq', 4, true);
331
+
332
+
333
+--
334
+-- Data for Name: sensor_types; Type: TABLE DATA; Schema: public; Owner: dev
335
+--
336
+
337
+INSERT INTO sensor_types VALUES (1, 'Dummy Sensor', 'App\Http\Business\Sensors\DummySensor', '{"Minimum": 0, "Maximum": 42}');
338
+INSERT INTO sensor_types VALUES (2, 'PiFace Digital', 'App\Http\Business\Sensors\PiFaceSensor', '{"Device": 0, "Pin":0, "True": "Openned", "False": "Closed"}');
339
+
340
+
341
+--
342
+-- Name: sensor_types_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dev
343
+--
344
+
345
+SELECT pg_catalog.setval('sensor_types_id_seq', 3, true);
346
+
347
+
348
+--
349
+-- Data for Name: sensors; Type: TABLE DATA; Schema: public; Owner: dev
350
+--
351
+
352
+INSERT INTO sensors VALUES (6, 'Dummy sensor', 'Get a random value', 9, 1, '{"Minimum":0,"Maximum":42}');
353
+INSERT INTO sensors VALUES (7, 'Dummy sensor 2', 'Get a negative random value', 9, 1, '{"Minimum":-42,"Maximum":0}');
354
+
355
+
356
+--
357
+-- Name: sensors_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dev
358
+--
359
+
360
+SELECT pg_catalog.setval('sensors_id_seq', 7, true);
361
+
362
+
363
+--
364
+-- PostgreSQL database dump complete
365
+--

+ 699
- 0
sql/struct_init.sql 파일 보기

@@ -0,0 +1,699 @@
1
+--
2
+-- PostgreSQL database dump
3
+--
4
+--
5
+-- Name: sp_lu_get_all_user_permission(integer); Type: FUNCTION; Schema: public; Owner: dev
6
+--
7
+
8
+CREATE FUNCTION sp_lu_get_all_user_permission(_user_id integer, OUT _permisson_name character varying, OUT val boolean) RETURNS SETOF record
9
+    LANGUAGE sql IMMUTABLE SECURITY DEFINER COST 10
10
+    AS $$
11
+SELECT p.name, sp_lu_get_user_permission(_user_id, p.name) FROM luticate_permissions p ORDER bY p.name
12
+$$;
13
+
14
+
15
+--
16
+-- Name: sp_lu_get_user_permission(integer, character varying); Type: FUNCTION; Schema: public; Owner: dev
17
+--
18
+
19
+CREATE FUNCTION sp_lu_get_user_permission(_user_id integer, _permisson_name character varying, OUT val boolean) RETURNS boolean
20
+    LANGUAGE plpgsql IMMUTABLE SECURITY DEFINER COST 10
21
+    AS $$
22
+DECLARE
23
+    groups int[];
24
+    g INT;
25
+BEGIN
26
+    SELECT "value" INTO val FROM luticate_permissions_users WHERE "user_id" = _user_id AND "name" = _permisson_name;
27
+    IF val is null THEN
28
+        SELECT lpg."value" into val FROM luticate_permissions_groups lpg
29
+            INNER JOIN luticate_groups lg ON lg."id" = lpg."group_id"
30
+            INNER JOIN luticate_users_groups lug ON lug."user_id" = _user_id AND lug."group_id" = lg."id"
31
+        WHERE lpg."name" = _permisson_name and lpg."value" = FALSE;
32
+        IF val is null then
33
+            SELECT lpg."value" into val FROM luticate_permissions_groups lpg
34
+                INNER JOIN luticate_groups lg ON lg."id" = lpg."group_id"
35
+                INNER JOIN luticate_users_groups lug ON lug."user_id" = _user_id AND lug."group_id" = lg."id"
36
+            WHERE lpg."name" = _permisson_name and lpg."value" = TRUE;
37
+            IF val is null then
38
+                SELECT "value" INTO val FROM luticate_permissions WHERE "name" = _permisson_name;
39
+            END IF;
40
+        end if;
41
+    END IF;
42
+END;
43
+$$;
44
+
45
+
46
+SET default_tablespace = '';
47
+
48
+SET default_with_oids = false;
49
+
50
+--
51
+-- Name: camera_types; Type: TABLE; Schema: public; Owner: dev; Tablespace: 
52
+--
53
+
54
+CREATE TABLE camera_types (
55
+    id integer NOT NULL,
56
+    name character varying(128) NOT NULL,
57
+    class character varying(128) NOT NULL,
58
+    default_data text NOT NULL
59
+);
60
+
61
+
62
+--
63
+-- Name: camera_types_id_seq; Type: SEQUENCE; Schema: public; Owner: dev
64
+--
65
+
66
+CREATE SEQUENCE camera_types_id_seq
67
+    START WITH 1
68
+    INCREMENT BY 1
69
+    NO MINVALUE
70
+    NO MAXVALUE
71
+    CACHE 1;
72
+
73
+
74
+--
75
+-- Name: camera_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: dev
76
+--
77
+
78
+ALTER SEQUENCE camera_types_id_seq OWNED BY camera_types.id;
79
+
80
+
81
+--
82
+-- Name: cameras; Type: TABLE; Schema: public; Owner: dev; Tablespace: 
83
+--
84
+
85
+CREATE TABLE cameras (
86
+    id integer NOT NULL,
87
+    name character varying(128) NOT NULL,
88
+    description character varying(256) NOT NULL,
89
+    host_id integer NOT NULL,
90
+    camera_type_id integer NOT NULL,
91
+    data text NOT NULL
92
+);
93
+
94
+
95
+--
96
+-- Name: cameras_id_seq; Type: SEQUENCE; Schema: public; Owner: dev
97
+--
98
+
99
+CREATE SEQUENCE cameras_id_seq
100
+    START WITH 1
101
+    INCREMENT BY 1
102
+    NO MINVALUE
103
+    NO MAXVALUE
104
+    CACHE 1;
105
+
106
+
107
+--
108
+-- Name: cameras_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: dev
109
+--
110
+
111
+ALTER SEQUENCE cameras_id_seq OWNED BY cameras.id;
112
+
113
+
114
+--
115
+-- Name: command_types; Type: TABLE; Schema: public; Owner: dev; Tablespace: 
116
+--
117
+
118
+CREATE TABLE command_types (
119
+    id integer NOT NULL,
120
+    name character varying(128) NOT NULL,
121
+    class character varying(128) NOT NULL,
122
+    default_data text NOT NULL
123
+);
124
+
125
+
126
+--
127
+-- Name: command_types_id_seq; Type: SEQUENCE; Schema: public; Owner: dev
128
+--
129
+
130
+CREATE SEQUENCE command_types_id_seq
131
+    START WITH 1
132
+    INCREMENT BY 1
133
+    NO MINVALUE
134
+    NO MAXVALUE
135
+    CACHE 1;
136
+
137
+
138
+--
139
+-- Name: command_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: dev
140
+--
141
+
142
+ALTER SEQUENCE command_types_id_seq OWNED BY command_types.id;
143
+
144
+
145
+--
146
+-- Name: commands; Type: TABLE; Schema: public; Owner: dev; Tablespace: 
147
+--
148
+
149
+CREATE TABLE commands (
150
+    id integer NOT NULL,
151
+    name character varying(128) NOT NULL,
152
+    description character varying(256) NOT NULL,
153
+    host_id integer NOT NULL,
154
+    command_type_id integer NOT NULL,
155
+    data text NOT NULL
156
+);
157
+
158
+
159
+--
160
+-- Name: commands_id_seq; Type: SEQUENCE; Schema: public; Owner: dev
161
+--
162
+
163
+CREATE SEQUENCE commands_id_seq
164
+    START WITH 1
165
+    INCREMENT BY 1
166
+    NO MINVALUE
167
+    NO MAXVALUE
168
+    CACHE 1;
169
+
170
+
171
+--
172
+-- Name: commands_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: dev
173
+--
174
+
175
+ALTER SEQUENCE commands_id_seq OWNED BY commands.id;
176
+
177
+
178
+--
179
+-- Name: hosts; Type: TABLE; Schema: public; Owner: dev; Tablespace: 
180
+--
181
+
182
+CREATE TABLE hosts (
183
+    id integer NOT NULL,
184
+    name character varying(128) NOT NULL,
185
+    url character varying(256) NOT NULL,
186
+    token character varying(128) NOT NULL
187
+);
188
+
189
+
190
+--
191
+-- Name: hosts_id_seq; Type: SEQUENCE; Schema: public; Owner: dev
192
+--
193
+
194
+CREATE SEQUENCE hosts_id_seq
195
+    START WITH 1
196
+    INCREMENT BY 1
197
+    NO MINVALUE
198
+    NO MAXVALUE
199
+    CACHE 1;
200
+
201
+
202
+--
203
+-- Name: hosts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: dev
204
+--
205
+
206
+ALTER SEQUENCE hosts_id_seq OWNED BY hosts.id;
207
+
208
+
209
+--
210
+-- Name: luticate_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: dev
211
+--
212
+
213
+CREATE SEQUENCE luticate_groups_id_seq
214
+    START WITH 1
215
+    INCREMENT BY 1
216
+    NO MINVALUE
217
+    NO MAXVALUE
218
+    CACHE 1;
219
+
220
+
221
+--
222
+-- Name: luticate_groups; Type: TABLE; Schema: public; Owner: dev; Tablespace: 
223
+--
224
+
225
+CREATE TABLE luticate_groups (
226
+    id integer DEFAULT nextval('luticate_groups_id_seq'::regclass) NOT NULL,
227
+    name character varying NOT NULL
228
+);
229
+
230
+
231
+--
232
+-- Name: luticate_permissions; Type: TABLE; Schema: public; Owner: dev; Tablespace: 
233
+--
234
+
235
+CREATE TABLE luticate_permissions (
236
+    name character varying(128) NOT NULL,
237
+    value boolean NOT NULL
238
+);
239
+
240
+
241
+--
242
+-- Name: luticate_permissions_groups; Type: TABLE; Schema: public; Owner: dev; Tablespace: 
243
+--
244
+
245
+CREATE TABLE luticate_permissions_groups (
246
+    name character varying(128) NOT NULL,
247
+    value boolean NOT NULL,
248
+    group_id integer NOT NULL
249
+);
250
+
251
+
252
+--
253
+-- Name: luticate_permissions_users; Type: TABLE; Schema: public; Owner: dev; Tablespace: 
254
+--
255
+
256
+CREATE TABLE luticate_permissions_users (
257
+    name character varying(128) NOT NULL,
258
+    value boolean,
259
+    user_id integer NOT NULL
260
+);
261
+
262
+
263
+--
264
+-- Name: luticate_users_id_seq; Type: SEQUENCE; Schema: public; Owner: dev
265
+--
266
+
267
+CREATE SEQUENCE luticate_users_id_seq
268
+    START WITH 1
269
+    INCREMENT BY 1
270
+    NO MINVALUE
271
+    NO MAXVALUE
272
+    CACHE 1;
273
+
274
+
275
+--
276
+-- Name: luticate_users; Type: TABLE; Schema: public; Owner: dev; Tablespace: 
277
+--
278
+
279
+CREATE TABLE luticate_users (
280
+    id integer DEFAULT nextval('luticate_users_id_seq'::regclass) NOT NULL,
281
+    username character varying(255) NOT NULL,
282
+    email character varying(255) NOT NULL,
283
+    password character varying(255) NOT NULL,
284
+    salt character varying(10) NOT NULL,
285
+    profile_id integer,
286
+    firstname character varying(255) NOT NULL,
287
+    lastname character varying(255) NOT NULL
288
+);
289
+
290
+
291
+--
292
+-- Name: luticate_users_groups; Type: TABLE; Schema: public; Owner: dev; Tablespace: 
293
+--
294
+
295
+CREATE TABLE luticate_users_groups (
296
+    user_id integer NOT NULL,
297
+    group_id integer NOT NULL
298
+);
299
+
300
+
301
+--
302
+-- Name: sensor_types; Type: TABLE; Schema: public; Owner: dev; Tablespace: 
303
+--
304
+
305
+CREATE TABLE sensor_types (
306
+    id integer NOT NULL,
307
+    name character varying(128) NOT NULL,
308
+    class character varying(128) NOT NULL,
309
+    default_data text NOT NULL
310
+);
311
+
312
+
313
+--
314
+-- Name: sensor_types_id_seq; Type: SEQUENCE; Schema: public; Owner: dev
315
+--
316
+
317
+CREATE SEQUENCE sensor_types_id_seq
318
+    START WITH 1
319
+    INCREMENT BY 1
320
+    NO MINVALUE
321
+    NO MAXVALUE
322
+    CACHE 1;
323
+
324
+
325
+--
326
+-- Name: sensor_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: dev
327
+--
328
+
329
+ALTER SEQUENCE sensor_types_id_seq OWNED BY sensor_types.id;
330
+
331
+
332
+--
333
+-- Name: sensors; Type: TABLE; Schema: public; Owner: dev; Tablespace: 
334
+--
335
+
336
+CREATE TABLE sensors (
337
+    id integer NOT NULL,
338
+    name character varying(128) NOT NULL,
339
+    description character varying(256) NOT NULL,
340
+    host_id integer NOT NULL,
341
+    sensor_type_id integer NOT NULL,
342
+    data text NOT NULL
343
+);
344
+
345
+
346
+--
347
+-- Name: sensors_id_seq; Type: SEQUENCE; Schema: public; Owner: dev
348
+--
349
+
350
+CREATE SEQUENCE sensors_id_seq
351
+    START WITH 1
352
+    INCREMENT BY 1
353
+    NO MINVALUE
354
+    NO MAXVALUE
355
+    CACHE 1;
356
+
357
+
358
+--
359
+-- Name: sensors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: dev
360
+--
361
+
362
+ALTER SEQUENCE sensors_id_seq OWNED BY sensors.id;
363
+
364
+
365
+--
366
+-- Name: id; Type: DEFAULT; Schema: public; Owner: dev
367
+--
368
+
369
+ALTER TABLE ONLY camera_types ALTER COLUMN id SET DEFAULT nextval('camera_types_id_seq'::regclass);
370
+
371
+
372
+--
373
+-- Name: id; Type: DEFAULT; Schema: public; Owner: dev
374
+--
375
+
376
+ALTER TABLE ONLY cameras ALTER COLUMN id SET DEFAULT nextval('cameras_id_seq'::regclass);
377
+
378
+
379
+--
380
+-- Name: id; Type: DEFAULT; Schema: public; Owner: dev
381
+--
382
+
383
+ALTER TABLE ONLY command_types ALTER COLUMN id SET DEFAULT nextval('command_types_id_seq'::regclass);
384
+
385
+
386
+--
387
+-- Name: id; Type: DEFAULT; Schema: public; Owner: dev
388
+--
389
+
390
+ALTER TABLE ONLY commands ALTER COLUMN id SET DEFAULT nextval('commands_id_seq'::regclass);
391
+
392
+
393
+--
394
+-- Name: id; Type: DEFAULT; Schema: public; Owner: dev
395
+--
396
+
397
+ALTER TABLE ONLY hosts ALTER COLUMN id SET DEFAULT nextval('hosts_id_seq'::regclass);
398
+
399
+
400
+--
401
+-- Name: id; Type: DEFAULT; Schema: public; Owner: dev
402
+--
403
+
404
+ALTER TABLE ONLY sensor_types ALTER COLUMN id SET DEFAULT nextval('sensor_types_id_seq'::regclass);
405
+
406
+
407
+--
408
+-- Name: id; Type: DEFAULT; Schema: public; Owner: dev
409
+--
410
+
411
+ALTER TABLE ONLY sensors ALTER COLUMN id SET DEFAULT nextval('sensors_id_seq'::regclass);
412
+
413
+
414
+--
415
+-- Name: camera_types_name_key; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
416
+--
417
+
418
+ALTER TABLE ONLY camera_types
419
+    ADD CONSTRAINT camera_types_name_key UNIQUE (name);
420
+
421
+
422
+--
423
+-- Name: camera_types_pkey; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
424
+--
425
+
426
+ALTER TABLE ONLY camera_types
427
+    ADD CONSTRAINT camera_types_pkey PRIMARY KEY (id);
428
+
429
+
430
+--
431
+-- Name: cameras_name_key; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
432
+--
433
+
434
+ALTER TABLE ONLY cameras
435
+    ADD CONSTRAINT cameras_name_key UNIQUE (name);
436
+
437
+
438
+--
439
+-- Name: cameras_pkey; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
440
+--
441
+
442
+ALTER TABLE ONLY cameras
443
+    ADD CONSTRAINT cameras_pkey PRIMARY KEY (id);
444
+
445
+
446
+--
447
+-- Name: command_types_name_key; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
448
+--
449
+
450
+ALTER TABLE ONLY command_types
451
+    ADD CONSTRAINT command_types_name_key UNIQUE (name);
452
+
453
+
454
+--
455
+-- Name: command_types_pkey; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
456
+--
457
+
458
+ALTER TABLE ONLY command_types
459
+    ADD CONSTRAINT command_types_pkey PRIMARY KEY (id);
460
+
461
+
462
+--
463
+-- Name: commands_name_key; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
464
+--
465
+
466
+ALTER TABLE ONLY commands
467
+    ADD CONSTRAINT commands_name_key UNIQUE (name);
468
+
469
+
470
+--
471
+-- Name: commands_pkey; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
472
+--
473
+
474
+ALTER TABLE ONLY commands
475
+    ADD CONSTRAINT commands_pkey PRIMARY KEY (id);
476
+
477
+
478
+--
479
+-- Name: hosts_name_key; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
480
+--
481
+
482
+ALTER TABLE ONLY hosts
483
+    ADD CONSTRAINT hosts_name_key UNIQUE (name);
484
+
485
+
486
+--
487
+-- Name: hosts_pkey; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
488
+--
489
+
490
+ALTER TABLE ONLY hosts
491
+    ADD CONSTRAINT hosts_pkey PRIMARY KEY (id);
492
+
493
+
494
+--
495
+-- Name: luticate_groups_name_key; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
496
+--
497
+
498
+ALTER TABLE ONLY luticate_groups
499
+    ADD CONSTRAINT luticate_groups_name_key UNIQUE (name);
500
+
501
+
502
+--
503
+-- Name: luticate_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
504
+--
505
+
506
+ALTER TABLE ONLY luticate_groups
507
+    ADD CONSTRAINT luticate_groups_pkey PRIMARY KEY (id);
508
+
509
+
510
+--
511
+-- Name: luticate_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
512
+--
513
+
514
+ALTER TABLE ONLY luticate_permissions
515
+    ADD CONSTRAINT luticate_permissions_pkey PRIMARY KEY (name);
516
+
517
+
518
+--
519
+-- Name: luticate_permissions_users_pkey; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
520
+--
521
+
522
+ALTER TABLE ONLY luticate_permissions_users
523
+    ADD CONSTRAINT luticate_permissions_users_pkey PRIMARY KEY (name, user_id);
524
+
525
+
526
+--
527
+-- Name: luticate_users_email_key; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
528
+--
529
+
530
+ALTER TABLE ONLY luticate_users
531
+    ADD CONSTRAINT luticate_users_email_key UNIQUE (email);
532
+
533
+
534
+--
535
+-- Name: luticate_users_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
536
+--
537
+
538
+ALTER TABLE ONLY luticate_users_groups
539
+    ADD CONSTRAINT luticate_users_groups_pkey PRIMARY KEY (user_id, group_id);
540
+
541
+
542
+--
543
+-- Name: luticate_users_pkey; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
544
+--
545
+
546
+ALTER TABLE ONLY luticate_users
547
+    ADD CONSTRAINT luticate_users_pkey PRIMARY KEY (id);
548
+
549
+
550
+--
551
+-- Name: luticate_users_username_key; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
552
+--
553
+
554
+ALTER TABLE ONLY luticate_users
555
+    ADD CONSTRAINT luticate_users_username_key UNIQUE (username);
556
+
557
+
558
+--
559
+-- Name: pkey; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
560
+--
561
+
562
+ALTER TABLE ONLY luticate_permissions_groups
563
+    ADD CONSTRAINT pkey PRIMARY KEY (name, group_id);
564
+
565
+
566
+--
567
+-- Name: sensor_types_name_key; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
568
+--
569
+
570
+ALTER TABLE ONLY sensor_types
571
+    ADD CONSTRAINT sensor_types_name_key UNIQUE (name);
572
+
573
+
574
+--
575
+-- Name: sensor_types_pkey; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
576
+--
577
+
578
+ALTER TABLE ONLY sensor_types
579
+    ADD CONSTRAINT sensor_types_pkey PRIMARY KEY (id);
580
+
581
+
582
+--
583
+-- Name: sensors_name_key; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
584
+--
585
+
586
+ALTER TABLE ONLY sensors
587
+    ADD CONSTRAINT sensors_name_key UNIQUE (name);
588
+
589
+
590
+--
591
+-- Name: sensors_pkey; Type: CONSTRAINT; Schema: public; Owner: dev; Tablespace: 
592
+--
593
+
594
+ALTER TABLE ONLY sensors
595
+    ADD CONSTRAINT sensors_pkey PRIMARY KEY (id);
596
+
597
+
598
+--
599
+-- Name: cameras_camera_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: dev
600
+--
601
+
602
+ALTER TABLE ONLY cameras
603
+    ADD CONSTRAINT cameras_camera_type_id_fkey FOREIGN KEY (camera_type_id) REFERENCES camera_types(id);
604
+
605
+
606
+--
607
+-- Name: cameras_host_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: dev
608
+--
609
+
610
+ALTER TABLE ONLY cameras
611
+    ADD CONSTRAINT cameras_host_id_fkey FOREIGN KEY (host_id) REFERENCES hosts(id) ON DELETE CASCADE;
612
+
613
+
614
+--
615
+-- Name: commands_command_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: dev
616
+--
617
+
618
+ALTER TABLE ONLY commands
619
+    ADD CONSTRAINT commands_command_type_id_fkey FOREIGN KEY (command_type_id) REFERENCES command_types(id) ON DELETE CASCADE;
620
+
621
+
622
+--
623
+-- Name: commands_host_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: dev
624
+--
625
+
626
+ALTER TABLE ONLY commands
627
+    ADD CONSTRAINT commands_host_id_fkey FOREIGN KEY (host_id) REFERENCES hosts(id) ON DELETE CASCADE;
628
+
629
+
630
+--
631
+-- Name: foreign_group; Type: FK CONSTRAINT; Schema: public; Owner: dev
632
+--
633
+
634
+ALTER TABLE ONLY luticate_permissions_groups
635
+    ADD CONSTRAINT foreign_group FOREIGN KEY (group_id) REFERENCES luticate_groups(id) ON DELETE CASCADE;
636
+
637
+
638
+--
639
+-- Name: foreign_group; Type: FK CONSTRAINT; Schema: public; Owner: dev
640
+--
641
+
642
+ALTER TABLE ONLY luticate_users_groups
643
+    ADD CONSTRAINT foreign_group FOREIGN KEY (group_id) REFERENCES luticate_groups(id) ON DELETE CASCADE;
644
+
645
+
646
+--
647
+-- Name: foreign_name; Type: FK CONSTRAINT; Schema: public; Owner: dev
648
+--
649
+
650
+ALTER TABLE ONLY luticate_permissions_groups
651
+    ADD CONSTRAINT foreign_name FOREIGN KEY (name) REFERENCES luticate_permissions(name) ON DELETE CASCADE;
652
+
653
+
654
+--
655
+-- Name: foreign_name; Type: FK CONSTRAINT; Schema: public; Owner: dev
656
+--
657
+
658
+ALTER TABLE ONLY luticate_permissions_users
659
+    ADD CONSTRAINT foreign_name FOREIGN KEY (name) REFERENCES luticate_permissions(name) ON DELETE CASCADE;
660
+
661
+
662
+--
663
+-- Name: foreign_user; Type: FK CONSTRAINT; Schema: public; Owner: dev
664
+--
665
+
666
+ALTER TABLE ONLY luticate_permissions_users
667
+    ADD CONSTRAINT foreign_user FOREIGN KEY (user_id) REFERENCES luticate_users(id) ON DELETE CASCADE;
668
+
669
+
670
+--
671
+-- Name: foreign_user; Type: FK CONSTRAINT; Schema: public; Owner: dev
672
+--
673
+
674
+ALTER TABLE ONLY luticate_users_groups
675
+    ADD CONSTRAINT foreign_user FOREIGN KEY (user_id) REFERENCES luticate_users(id) ON DELETE CASCADE;
676
+
677
+
678
+--
679
+-- Name: sensors_host_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: dev
680
+--
681
+
682
+ALTER TABLE ONLY sensors
683
+    ADD CONSTRAINT sensors_host_id_fkey FOREIGN KEY (host_id) REFERENCES hosts(id) ON DELETE CASCADE;
684
+
685
+
686
+--
687
+-- Name: sensors_sensor_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: dev
688
+--
689
+
690
+ALTER TABLE ONLY sensors
691
+    ADD CONSTRAINT sensors_sensor_type_id_fkey FOREIGN KEY (sensor_type_id) REFERENCES sensor_types(id) ON DELETE CASCADE;
692
+
693
+
694
+--
695
+-- Name: public; Type: ACL; Schema: -; Owner: postgres
696
+--
697
+--
698
+-- PostgreSQL database dump complete
699
+--

Loading…
취소
저장