1 | ----------------------------------------------------------------------------- |
---|
2 | -- piwigo_caddie |
---|
3 | ----------------------------------------------------------------------------- |
---|
4 | |
---|
5 | DROP TABLE IF EXISTS piwigo_caddie; |
---|
6 | CREATE TABLE "piwigo_caddie" |
---|
7 | ( |
---|
8 | "user_id" INTEGER default 0 NOT NULL, |
---|
9 | "element_id" INTEGER default 0 NOT NULL, |
---|
10 | PRIMARY KEY ("user_id","element_id") |
---|
11 | ); |
---|
12 | |
---|
13 | COMMENT ON TABLE "piwigo_caddie" IS ''; |
---|
14 | |
---|
15 | |
---|
16 | SET search_path TO public; |
---|
17 | ----------------------------------------------------------------------------- |
---|
18 | -- piwigo_categories |
---|
19 | ----------------------------------------------------------------------------- |
---|
20 | |
---|
21 | DROP TYPE IF EXISTS CATEGORIES_STATUS; |
---|
22 | CREATE TYPE CATEGORIES_STATUS AS ENUM('public', 'private'); |
---|
23 | |
---|
24 | DROP TABLE IF EXISTS "piwigo_categories" CASCADE; |
---|
25 | CREATE TABLE "piwigo_categories" |
---|
26 | ( |
---|
27 | "id" serial NOT NULL, |
---|
28 | "name" VARCHAR(255) default '' NOT NULL, |
---|
29 | "id_uppercat" INTEGER, |
---|
30 | "comment" TEXT, |
---|
31 | "dir" VARCHAR(255), |
---|
32 | "rank" INTEGER, |
---|
33 | "status" CATEGORIES_STATUS default 'public'::CATEGORIES_STATUS, |
---|
34 | "site_id" INTEGER default 1, |
---|
35 | "visible" BOOLEAN default true, |
---|
36 | "uploadable" BOOLEAN default false, |
---|
37 | "representative_picture_id" INTEGER, |
---|
38 | "uppercats" TEXT, |
---|
39 | "commentable" BOOLEAN default true, |
---|
40 | "global_rank" VARCHAR(255), |
---|
41 | "image_order" VARCHAR(128), |
---|
42 | "permalink" VARCHAR(64), |
---|
43 | PRIMARY KEY ("id"), |
---|
44 | CONSTRAINT "categories_i3" UNIQUE ("permalink") |
---|
45 | ); |
---|
46 | |
---|
47 | COMMENT ON TABLE "piwigo_categories" IS ''; |
---|
48 | |
---|
49 | |
---|
50 | SET search_path TO public; |
---|
51 | CREATE INDEX "categories_i2" ON "piwigo_categories" ("id_uppercat"); |
---|
52 | |
---|
53 | ----------------------------------------------------------------------------- |
---|
54 | -- piwigo_config |
---|
55 | ----------------------------------------------------------------------------- |
---|
56 | |
---|
57 | DROP TABLE IF EXISTS "piwigo_config" CASCADE; |
---|
58 | CREATE TABLE "piwigo_config" |
---|
59 | ( |
---|
60 | "param" VARCHAR(40) default '' NOT NULL, |
---|
61 | "value" TEXT, |
---|
62 | "comment" VARCHAR(255), |
---|
63 | PRIMARY KEY ("param") |
---|
64 | ); |
---|
65 | |
---|
66 | COMMENT ON TABLE "piwigo_config" IS ''; |
---|
67 | |
---|
68 | |
---|
69 | SET search_path TO public; |
---|
70 | ----------------------------------------------------------------------------- |
---|
71 | -- piwigo_favorites |
---|
72 | ----------------------------------------------------------------------------- |
---|
73 | |
---|
74 | DROP TABLE IF EXISTS "piwigo_favorites" CASCADE; |
---|
75 | CREATE TABLE "piwigo_favorites" |
---|
76 | ( |
---|
77 | "user_id" INTEGER default 0 NOT NULL, |
---|
78 | "image_id" INTEGER default 0 NOT NULL, |
---|
79 | PRIMARY KEY ("user_id","image_id") |
---|
80 | ); |
---|
81 | |
---|
82 | COMMENT ON TABLE "piwigo_favorites" IS ''; |
---|
83 | |
---|
84 | |
---|
85 | SET search_path TO public; |
---|
86 | ----------------------------------------------------------------------------- |
---|
87 | -- piwigo_group_access |
---|
88 | ----------------------------------------------------------------------------- |
---|
89 | |
---|
90 | DROP TABLE IF EXISTS "piwigo_group_access" CASCADE; |
---|
91 | CREATE TABLE "piwigo_group_access" |
---|
92 | ( |
---|
93 | "group_id" INTEGER default 0 NOT NULL, |
---|
94 | "cat_id" INTEGER default 0 NOT NULL, |
---|
95 | PRIMARY KEY ("group_id","cat_id") |
---|
96 | ); |
---|
97 | |
---|
98 | COMMENT ON TABLE "piwigo_group_access" IS ''; |
---|
99 | |
---|
100 | |
---|
101 | SET search_path TO public; |
---|
102 | ----------------------------------------------------------------------------- |
---|
103 | -- piwigo_groups |
---|
104 | ----------------------------------------------------------------------------- |
---|
105 | |
---|
106 | DROP TABLE IF EXISTS "piwigo_groups" CASCADE; |
---|
107 | CREATE TABLE "piwigo_groups" |
---|
108 | ( |
---|
109 | "id" serial NOT NULL, |
---|
110 | "name" VARCHAR(255) default '' NOT NULL, |
---|
111 | "is_default" BOOLEAN default false, |
---|
112 | PRIMARY KEY ("id"), |
---|
113 | CONSTRAINT "groups_ui1" UNIQUE ("name") |
---|
114 | ); |
---|
115 | |
---|
116 | COMMENT ON TABLE "piwigo_groups" IS ''; |
---|
117 | |
---|
118 | |
---|
119 | SET search_path TO public; |
---|
120 | ----------------------------------------------------------------------------- |
---|
121 | -- piwigo_history |
---|
122 | ----------------------------------------------------------------------------- |
---|
123 | |
---|
124 | DROP TYPE IF EXISTS HISTORY_SECTION; |
---|
125 | CREATE TYPE HISTORY_SECTION AS ENUM('categories','tags','search','list','favorites','most_visited','best_rated','recent_pics','recent_cats'); |
---|
126 | DROP TYPE IF EXISTS HISTORY_IMAGE_TYPE; |
---|
127 | CREATE TYPE HISTORY_IMAGE_TYPE AS ENUM('picture','high','other'); |
---|
128 | |
---|
129 | DROP TABLE IF EXISTS "piwigo_history" CASCADE; |
---|
130 | CREATE TABLE "piwigo_history" |
---|
131 | ( |
---|
132 | "id" serial NOT NULL, |
---|
133 | "date" DATE NOT NULL, |
---|
134 | "time" TIME NOT NULL, |
---|
135 | "user_id" INTEGER default 0 NOT NULL, |
---|
136 | "ip" VARCHAR(15) default '' NOT NULL, |
---|
137 | "section" HISTORY_SECTION default NULL, |
---|
138 | "category_id" INTEGER, |
---|
139 | "tag_ids" VARCHAR(50), |
---|
140 | "image_id" INTEGER, |
---|
141 | "summarized" BOOLEAN default false, |
---|
142 | "image_type" HISTORY_IMAGE_TYPE default NULL, |
---|
143 | PRIMARY KEY ("id") |
---|
144 | ); |
---|
145 | |
---|
146 | COMMENT ON TABLE "piwigo_history" IS ''; |
---|
147 | |
---|
148 | |
---|
149 | SET search_path TO public; |
---|
150 | CREATE INDEX "history_i1" ON "piwigo_history" ("summarized"); |
---|
151 | |
---|
152 | ----------------------------------------------------------------------------- |
---|
153 | -- piwigo_history_summary |
---|
154 | ----------------------------------------------------------------------------- |
---|
155 | |
---|
156 | DROP TABLE IF EXISTS "piwigo_history_summary" CASCADE; |
---|
157 | CREATE TABLE "piwigo_history_summary" |
---|
158 | ( |
---|
159 | "year" INTEGER default 0 NOT NULL, |
---|
160 | "month" INTEGER, |
---|
161 | "day" INTEGER, |
---|
162 | "hour" INTEGER, |
---|
163 | "nb_pages" INTEGER, |
---|
164 | "id" serial NOT NULL, |
---|
165 | PRIMARY KEY ("id"), |
---|
166 | CONSTRAINT "history_summary_ymdh" UNIQUE ("year","month","day","hour") |
---|
167 | ); |
---|
168 | |
---|
169 | COMMENT ON TABLE "piwigo_history_summary" IS ''; |
---|
170 | |
---|
171 | |
---|
172 | SET search_path TO public; |
---|
173 | ----------------------------------------------------------------------------- |
---|
174 | -- piwigo_image_category |
---|
175 | ----------------------------------------------------------------------------- |
---|
176 | |
---|
177 | DROP TABLE IF EXISTS "piwigo_image_category" CASCADE; |
---|
178 | CREATE TABLE "piwigo_image_category" |
---|
179 | ( |
---|
180 | "image_id" INTEGER default 0 NOT NULL, |
---|
181 | "category_id" INTEGER default 0 NOT NULL, |
---|
182 | "rank" INTEGER, |
---|
183 | PRIMARY KEY ("image_id","category_id") |
---|
184 | ); |
---|
185 | |
---|
186 | COMMENT ON TABLE "piwigo_image_category" IS ''; |
---|
187 | |
---|
188 | |
---|
189 | SET search_path TO public; |
---|
190 | CREATE INDEX "image_category_i1" ON "piwigo_image_category" ("category_id"); |
---|
191 | |
---|
192 | ----------------------------------------------------------------------------- |
---|
193 | -- piwigo_image_tag |
---|
194 | ----------------------------------------------------------------------------- |
---|
195 | |
---|
196 | DROP TABLE IF EXISTS "piwigo_image_tag" CASCADE; |
---|
197 | CREATE TABLE "piwigo_image_tag" |
---|
198 | ( |
---|
199 | "image_id" INTEGER default 0 NOT NULL, |
---|
200 | "tag_id" INTEGER default 0 NOT NULL, |
---|
201 | PRIMARY KEY ("image_id","tag_id") |
---|
202 | ); |
---|
203 | |
---|
204 | COMMENT ON TABLE "piwigo_image_tag" IS ''; |
---|
205 | |
---|
206 | |
---|
207 | SET search_path TO public; |
---|
208 | CREATE INDEX "image_tag_i1" ON "piwigo_image_tag" ("tag_id"); |
---|
209 | |
---|
210 | ----------------------------------------------------------------------------- |
---|
211 | -- piwigo_images |
---|
212 | ----------------------------------------------------------------------------- |
---|
213 | |
---|
214 | DROP TABLE IF EXISTS "piwigo_images" CASCADE; |
---|
215 | CREATE TABLE "piwigo_images" |
---|
216 | ( |
---|
217 | "id" serial NOT NULL, |
---|
218 | "file" VARCHAR(255) default '' NOT NULL, |
---|
219 | "date_available" TIMESTAMP NOT NULL, |
---|
220 | "date_creation" TIMESTAMP, |
---|
221 | "tn_ext" VARCHAR(4) default '', |
---|
222 | "name" VARCHAR(255), |
---|
223 | "comment" TEXT, |
---|
224 | "author" VARCHAR(255), |
---|
225 | "hit" INTEGER default 0 NOT NULL, |
---|
226 | "filesize" INTEGER, |
---|
227 | "width" INTEGER, |
---|
228 | "height" INTEGER, |
---|
229 | "representative_ext" VARCHAR(4), |
---|
230 | "date_metadata_update" DATE, |
---|
231 | "average_rate" FLOAT, |
---|
232 | "has_high" BOOLEAN default false, |
---|
233 | "path" VARCHAR(255) default '' NOT NULL, |
---|
234 | "storage_category_id" INTEGER, |
---|
235 | "high_filesize" INTEGER, |
---|
236 | "level" INTEGER default 0 NOT NULL, |
---|
237 | "md5sum" CHAR(32), |
---|
238 | PRIMARY KEY ("id") |
---|
239 | ); |
---|
240 | |
---|
241 | COMMENT ON TABLE "piwigo_images" IS ''; |
---|
242 | |
---|
243 | |
---|
244 | SET search_path TO public; |
---|
245 | CREATE INDEX "images_i2" ON "piwigo_images" ("date_available"); |
---|
246 | |
---|
247 | CREATE INDEX "images_i3" ON "piwigo_images" ("average_rate"); |
---|
248 | |
---|
249 | CREATE INDEX "images_i4" ON "piwigo_images" ("hit"); |
---|
250 | |
---|
251 | CREATE INDEX "images_i5" ON "piwigo_images" ("date_creation"); |
---|
252 | |
---|
253 | CREATE INDEX "images_i1" ON "piwigo_images" ("storage_category_id"); |
---|
254 | |
---|
255 | ----------------------------------------------------------------------------- |
---|
256 | -- piwigo_old_permalinks |
---|
257 | ----------------------------------------------------------------------------- |
---|
258 | |
---|
259 | DROP TABLE IF EXISTS "piwigo_old_permalinks" CASCADE; |
---|
260 | CREATE TABLE "piwigo_old_permalinks" |
---|
261 | ( |
---|
262 | "cat_id" INTEGER default 0 NOT NULL, |
---|
263 | "permalink" VARCHAR(64) default '' NOT NULL, |
---|
264 | "date_deleted" TIMESTAMP NOT NULL, |
---|
265 | "last_hit" TIMESTAMP, |
---|
266 | "hit" INTEGER default 0 NOT NULL, |
---|
267 | PRIMARY KEY ("permalink") |
---|
268 | ); |
---|
269 | |
---|
270 | COMMENT ON TABLE "piwigo_old_permalinks" IS ''; |
---|
271 | |
---|
272 | |
---|
273 | SET search_path TO public; |
---|
274 | ----------------------------------------------------------------------------- |
---|
275 | -- piwigo_plugins |
---|
276 | ----------------------------------------------------------------------------- |
---|
277 | |
---|
278 | DROP TYPE IF EXISTS PLUGINS_STATE; |
---|
279 | CREATE TYPE PLUGINS_STATE AS ENUM('active', 'inactive'); |
---|
280 | |
---|
281 | DROP TABLE IF EXISTS "piwigo_plugins" CASCADE; |
---|
282 | CREATE TABLE "piwigo_plugins" |
---|
283 | ( |
---|
284 | "id" VARCHAR(64) default '' NOT NULL, |
---|
285 | "state" PLUGINS_STATE default 'inactive'::PLUGINS_STATE, |
---|
286 | "version" VARCHAR(64) default '0' NOT NULL, |
---|
287 | PRIMARY KEY ("id") |
---|
288 | ); |
---|
289 | |
---|
290 | COMMENT ON TABLE "piwigo_plugins" IS ''; |
---|
291 | |
---|
292 | |
---|
293 | SET search_path TO public; |
---|
294 | ----------------------------------------------------------------------------- |
---|
295 | -- piwigo_rate |
---|
296 | ----------------------------------------------------------------------------- |
---|
297 | |
---|
298 | DROP TABLE IF EXISTS "piwigo_rate" CASCADE; |
---|
299 | CREATE TABLE "piwigo_rate" |
---|
300 | ( |
---|
301 | "user_id" INTEGER default 0 NOT NULL, |
---|
302 | "element_id" INTEGER default 0 NOT NULL, |
---|
303 | "anonymous_id" VARCHAR(45) default '' NOT NULL, |
---|
304 | "rate" INTEGER default 0 NOT NULL, |
---|
305 | "date" DATE NOT NULL, |
---|
306 | PRIMARY KEY ("user_id","element_id","anonymous_id") |
---|
307 | ); |
---|
308 | |
---|
309 | COMMENT ON TABLE "piwigo_rate" IS ''; |
---|
310 | |
---|
311 | |
---|
312 | SET search_path TO public; |
---|
313 | ----------------------------------------------------------------------------- |
---|
314 | -- piwigo_search |
---|
315 | ----------------------------------------------------------------------------- |
---|
316 | |
---|
317 | DROP TABLE IF EXISTS "piwigo_search" CASCADE; |
---|
318 | CREATE TABLE "piwigo_search" |
---|
319 | ( |
---|
320 | "id" serial NOT NULL, |
---|
321 | "last_seen" DATE, |
---|
322 | "rules" TEXT, |
---|
323 | PRIMARY KEY ("id") |
---|
324 | ); |
---|
325 | |
---|
326 | COMMENT ON TABLE "piwigo_search" IS ''; |
---|
327 | |
---|
328 | |
---|
329 | SET search_path TO public; |
---|
330 | ----------------------------------------------------------------------------- |
---|
331 | -- piwigo_sessions |
---|
332 | ----------------------------------------------------------------------------- |
---|
333 | |
---|
334 | DROP TABLE IF EXISTS "piwigo_sessions" CASCADE; |
---|
335 | CREATE TABLE "piwigo_sessions" |
---|
336 | ( |
---|
337 | "id" VARCHAR(255) default '' NOT NULL, |
---|
338 | "data" TEXT NOT NULL, |
---|
339 | "expiration" TIMESTAMP NOT NULL, |
---|
340 | PRIMARY KEY ("id") |
---|
341 | ); |
---|
342 | |
---|
343 | COMMENT ON TABLE "piwigo_sessions" IS ''; |
---|
344 | |
---|
345 | |
---|
346 | SET search_path TO public; |
---|
347 | ----------------------------------------------------------------------------- |
---|
348 | -- piwigo_sites |
---|
349 | ----------------------------------------------------------------------------- |
---|
350 | |
---|
351 | DROP TABLE IF EXISTS "piwigo_sites" CASCADE; |
---|
352 | CREATE TABLE "piwigo_sites" |
---|
353 | ( |
---|
354 | "id" serial NOT NULL, |
---|
355 | "galleries_url" VARCHAR(255) default '' NOT NULL, |
---|
356 | PRIMARY KEY ("id"), |
---|
357 | CONSTRAINT "sites_ui1" UNIQUE ("galleries_url") |
---|
358 | ); |
---|
359 | |
---|
360 | COMMENT ON TABLE "piwigo_sites" IS ''; |
---|
361 | |
---|
362 | |
---|
363 | SET search_path TO public; |
---|
364 | ----------------------------------------------------------------------------- |
---|
365 | -- piwigo_stuffs |
---|
366 | ----------------------------------------------------------------------------- |
---|
367 | |
---|
368 | DROP TABLE IF EXISTS "piwigo_stuffs" CASCADE; |
---|
369 | CREATE TABLE "piwigo_stuffs" |
---|
370 | ( |
---|
371 | "id" INTEGER NOT NULL, |
---|
372 | "pos" INTEGER NOT NULL, |
---|
373 | "name" TEXT NOT NULL, |
---|
374 | "descr" VARCHAR(255), |
---|
375 | "type" VARCHAR(255) NOT NULL, |
---|
376 | "datas" TEXT, |
---|
377 | "users" VARCHAR(255), |
---|
378 | "groups" VARCHAR(255), |
---|
379 | "show_title" CHAR NOT NULL, |
---|
380 | "on_home" CHAR NOT NULL, |
---|
381 | "on_cats" CHAR NOT NULL, |
---|
382 | "on_picture" CHAR NOT NULL, |
---|
383 | "id_line" VARCHAR(1), |
---|
384 | "width" INTEGER, |
---|
385 | PRIMARY KEY ("id") |
---|
386 | ); |
---|
387 | |
---|
388 | COMMENT ON TABLE "piwigo_stuffs" IS ''; |
---|
389 | |
---|
390 | |
---|
391 | SET search_path TO public; |
---|
392 | CREATE INDEX "on_home" ON "piwigo_stuffs" ("on_home"); |
---|
393 | |
---|
394 | CREATE INDEX "on_cats" ON "piwigo_stuffs" ("on_cats"); |
---|
395 | |
---|
396 | CREATE INDEX "on_picture" ON "piwigo_stuffs" ("on_picture"); |
---|
397 | |
---|
398 | ----------------------------------------------------------------------------- |
---|
399 | -- piwigo_tags |
---|
400 | ----------------------------------------------------------------------------- |
---|
401 | |
---|
402 | DROP TABLE IF EXISTS "piwigo_tags" CASCADE; |
---|
403 | CREATE TABLE "piwigo_tags" |
---|
404 | ( |
---|
405 | "id" serial NOT NULL, |
---|
406 | "name" VARCHAR(255) default '' NOT NULL, |
---|
407 | "url_name" VARCHAR(255) default '' NOT NULL, |
---|
408 | PRIMARY KEY ("id") |
---|
409 | ); |
---|
410 | |
---|
411 | COMMENT ON TABLE "piwigo_tags" IS ''; |
---|
412 | |
---|
413 | |
---|
414 | SET search_path TO public; |
---|
415 | CREATE INDEX "tags_i1" ON "piwigo_tags" ("url_name"); |
---|
416 | |
---|
417 | ----------------------------------------------------------------------------- |
---|
418 | -- piwigo_upgrade |
---|
419 | ----------------------------------------------------------------------------- |
---|
420 | |
---|
421 | DROP TABLE IF EXISTS "piwigo_upgrade" CASCADE; |
---|
422 | CREATE TABLE "piwigo_upgrade" |
---|
423 | ( |
---|
424 | "id" VARCHAR(20) default '' NOT NULL, |
---|
425 | "applied" TIMESTAMP NOT NULL, |
---|
426 | "description" VARCHAR(255), |
---|
427 | PRIMARY KEY ("id") |
---|
428 | ); |
---|
429 | |
---|
430 | COMMENT ON TABLE "piwigo_upgrade" IS ''; |
---|
431 | |
---|
432 | |
---|
433 | SET search_path TO public; |
---|
434 | ----------------------------------------------------------------------------- |
---|
435 | -- piwigo_user_access |
---|
436 | ----------------------------------------------------------------------------- |
---|
437 | |
---|
438 | DROP TABLE IF EXISTS "piwigo_user_access" CASCADE; |
---|
439 | CREATE TABLE "piwigo_user_access" |
---|
440 | ( |
---|
441 | "user_id" INTEGER default 0 NOT NULL, |
---|
442 | "cat_id" INTEGER default 0 NOT NULL, |
---|
443 | PRIMARY KEY ("user_id","cat_id") |
---|
444 | ); |
---|
445 | |
---|
446 | COMMENT ON TABLE "piwigo_user_access" IS ''; |
---|
447 | |
---|
448 | |
---|
449 | SET search_path TO public; |
---|
450 | ----------------------------------------------------------------------------- |
---|
451 | -- piwigo_user_cache |
---|
452 | ----------------------------------------------------------------------------- |
---|
453 | |
---|
454 | DROP TYPE IF EXISTS USER_CACHE_IMAGE_ACCESS_TYPE; |
---|
455 | CREATE TYPE USER_CACHE_IMAGE_ACCESS_TYPE AS ENUM('NOT IN','IN'); |
---|
456 | |
---|
457 | DROP TABLE IF EXISTS "piwigo_user_cache" CASCADE; |
---|
458 | CREATE TABLE "piwigo_user_cache" |
---|
459 | ( |
---|
460 | "user_id" INTEGER default 0 NOT NULL, |
---|
461 | "need_update" BOOLEAN default true, |
---|
462 | "cache_update_time" INTEGER default 0 NOT NULL, |
---|
463 | "forbidden_categories" TEXT, |
---|
464 | "nb_total_images" INTEGER, |
---|
465 | "image_access_type" USER_CACHE_IMAGE_ACCESS_TYPE default 'NOT IN'::USER_CACHE_IMAGE_ACCESS_TYPE, |
---|
466 | "image_access_list" TEXT, |
---|
467 | PRIMARY KEY ("user_id") |
---|
468 | ); |
---|
469 | |
---|
470 | COMMENT ON TABLE "piwigo_user_cache" IS ''; |
---|
471 | |
---|
472 | |
---|
473 | SET search_path TO public; |
---|
474 | ----------------------------------------------------------------------------- |
---|
475 | -- piwigo_user_cache_categories |
---|
476 | ----------------------------------------------------------------------------- |
---|
477 | |
---|
478 | DROP TABLE IF EXISTS "piwigo_user_cache_categories" CASCADE; |
---|
479 | CREATE TABLE "piwigo_user_cache_categories" |
---|
480 | ( |
---|
481 | "user_id" INTEGER default 0 NOT NULL, |
---|
482 | "cat_id" INTEGER default 0 NOT NULL, |
---|
483 | "date_last" TIMESTAMP, |
---|
484 | "max_date_last" TIMESTAMP, |
---|
485 | "nb_images" INTEGER default 0 NOT NULL, |
---|
486 | "count_images" INTEGER default 0, |
---|
487 | "count_categories" INTEGER default 0, |
---|
488 | PRIMARY KEY ("user_id","cat_id") |
---|
489 | ); |
---|
490 | |
---|
491 | COMMENT ON TABLE "piwigo_user_cache_categories" IS ''; |
---|
492 | |
---|
493 | |
---|
494 | SET search_path TO public; |
---|
495 | ----------------------------------------------------------------------------- |
---|
496 | -- piwigo_user_feed |
---|
497 | ----------------------------------------------------------------------------- |
---|
498 | |
---|
499 | DROP TABLE IF EXISTS "piwigo_user_feed" CASCADE; |
---|
500 | CREATE TABLE "piwigo_user_feed" |
---|
501 | ( |
---|
502 | "id" VARCHAR(50) default '' NOT NULL, |
---|
503 | "user_id" INTEGER default 0 NOT NULL, |
---|
504 | "last_check" TIMESTAMP, |
---|
505 | PRIMARY KEY ("id") |
---|
506 | ); |
---|
507 | |
---|
508 | COMMENT ON TABLE "piwigo_user_feed" IS ''; |
---|
509 | |
---|
510 | |
---|
511 | SET search_path TO public; |
---|
512 | ----------------------------------------------------------------------------- |
---|
513 | -- piwigo_user_group |
---|
514 | ----------------------------------------------------------------------------- |
---|
515 | |
---|
516 | DROP TABLE IF EXISTS "piwigo_user_group" CASCADE; |
---|
517 | CREATE TABLE "piwigo_user_group" |
---|
518 | ( |
---|
519 | "user_id" INTEGER default 0 NOT NULL, |
---|
520 | "group_id" INTEGER default 0 NOT NULL, |
---|
521 | PRIMARY KEY ("user_id","group_id") |
---|
522 | ); |
---|
523 | |
---|
524 | COMMENT ON TABLE "piwigo_user_group" IS ''; |
---|
525 | |
---|
526 | |
---|
527 | SET search_path TO public; |
---|
528 | ----------------------------------------------------------------------------- |
---|
529 | -- piwigo_user_infos |
---|
530 | ----------------------------------------------------------------------------- |
---|
531 | |
---|
532 | DROP TYPE IF EXISTS USER_INFOS_STATUS; |
---|
533 | CREATE TYPE USER_INFOS_STATUS AS ENUM('webmaster','admin','normal','generic','guest'); |
---|
534 | |
---|
535 | DROP TABLE IF EXISTS "piwigo_user_infos" CASCADE; |
---|
536 | CREATE TABLE "piwigo_user_infos" |
---|
537 | ( |
---|
538 | "user_id" INTEGER default 0 NOT NULL, |
---|
539 | "nb_image_line" INTEGER default 5 NOT NULL, |
---|
540 | "nb_line_page" INTEGER default 3 NOT NULL, |
---|
541 | "status" USER_INFOS_STATUS default 'guest'::USER_INFOS_STATUS, |
---|
542 | "adviser" BOOLEAN default false, |
---|
543 | "language" VARCHAR(50) default 'en_UK' NOT NULL, |
---|
544 | "maxwidth" INTEGER, |
---|
545 | "maxheight" INTEGER, |
---|
546 | "expand" BOOLEAN default false, |
---|
547 | "show_nb_comments" BOOLEAN default false, |
---|
548 | "show_nb_hits" BOOLEAN default false, |
---|
549 | "recent_period" INTEGER default 7 NOT NULL, |
---|
550 | "theme" VARCHAR(255) default 'Sylvia' NOT NULL, |
---|
551 | "registration_date" TIMESTAMP NOT NULL, |
---|
552 | "enabled_high" BOOLEAN default true, |
---|
553 | "level" INTEGER default 0 NOT NULL, |
---|
554 | PRIMARY KEY ("user_id"), |
---|
555 | CONSTRAINT "user_infos_ui1" UNIQUE ("user_id") |
---|
556 | ); |
---|
557 | |
---|
558 | COMMENT ON TABLE "piwigo_user_infos" IS ''; |
---|
559 | |
---|
560 | |
---|
561 | SET search_path TO public; |
---|
562 | ----------------------------------------------------------------------------- |
---|
563 | -- piwigo_user_mail_notification |
---|
564 | ----------------------------------------------------------------------------- |
---|
565 | |
---|
566 | DROP TABLE IF EXISTS "piwigo_user_mail_notification" CASCADE; |
---|
567 | CREATE TABLE "piwigo_user_mail_notification" |
---|
568 | ( |
---|
569 | "user_id" INTEGER default 0 NOT NULL, |
---|
570 | "check_key" VARCHAR(16) default '' NOT NULL, |
---|
571 | "enabled" BOOLEAN default false, |
---|
572 | "last_send" TIMESTAMP, |
---|
573 | PRIMARY KEY ("user_id"), |
---|
574 | CONSTRAINT "user_mail_notification_ui1" UNIQUE ("check_key") |
---|
575 | ); |
---|
576 | |
---|
577 | COMMENT ON TABLE "piwigo_user_mail_notification" IS ''; |
---|
578 | |
---|
579 | |
---|
580 | SET search_path TO public; |
---|
581 | ----------------------------------------------------------------------------- |
---|
582 | -- piwigo_users |
---|
583 | ----------------------------------------------------------------------------- |
---|
584 | |
---|
585 | DROP TABLE IF EXISTS "piwigo_users" CASCADE; |
---|
586 | CREATE TABLE "piwigo_users" |
---|
587 | ( |
---|
588 | "id" serial NOT NULL, |
---|
589 | "username" VARCHAR(100) default '' NOT NULL, |
---|
590 | "password" VARCHAR(32), |
---|
591 | "mail_address" VARCHAR(255), |
---|
592 | PRIMARY KEY ("id"), |
---|
593 | CONSTRAINT "users_ui1" UNIQUE ("username") |
---|
594 | ); |
---|
595 | |
---|
596 | COMMENT ON TABLE "piwigo_users" IS ''; |
---|
597 | |
---|
598 | |
---|
599 | SET search_path TO public; |
---|
600 | |
---|
601 | ----------------------------------------------------------------------------- |
---|
602 | -- piwigo_comments |
---|
603 | ----------------------------------------------------------------------------- |
---|
604 | |
---|
605 | DROP TABLE IF EXISTS "piwigo_comments" CASCADE; |
---|
606 | CREATE TABLE "piwigo_comments" |
---|
607 | ( |
---|
608 | "id" serial NOT NULL, |
---|
609 | "image_id" INTEGER default 0 NOT NULL, |
---|
610 | "date" TIMESTAMP NOT NULL, |
---|
611 | "author" VARCHAR(255), |
---|
612 | "content" TEXT, |
---|
613 | "validated" BOOLEAN default false, |
---|
614 | "validation_date" TIMESTAMP, |
---|
615 | "author_id" INTEGER REFERENCES "piwigo_users" (id), |
---|
616 | PRIMARY KEY ("id") |
---|
617 | ); |
---|
618 | |
---|
619 | COMMENT ON TABLE "piwigo_comments" IS ''; |
---|
620 | |
---|
621 | |
---|
622 | SET search_path TO public; |
---|
623 | CREATE INDEX "comments_i2" ON "piwigo_comments" ("validation_date"); |
---|
624 | |
---|
625 | CREATE INDEX "comments_i1" ON "piwigo_comments" ("image_id"); |
---|
626 | |
---|
627 | ----------------------------------------------------------------------------- |
---|
628 | -- piwigo_waiting |
---|
629 | ----------------------------------------------------------------------------- |
---|
630 | |
---|
631 | DROP TABLE IF EXISTS "piwigo_waiting" CASCADE; |
---|
632 | CREATE TABLE "piwigo_waiting" |
---|
633 | ( |
---|
634 | "id" serial NOT NULL, |
---|
635 | "storage_category_id" INTEGER default 0 NOT NULL, |
---|
636 | "file" VARCHAR(255) default '' NOT NULL, |
---|
637 | "username" VARCHAR(255) default '' NOT NULL, |
---|
638 | "mail_address" VARCHAR(255) default '' NOT NULL, |
---|
639 | "date" INTEGER default 0 NOT NULL, |
---|
640 | "tn_ext" CHAR(3), |
---|
641 | "validated" BOOLEAN default false, |
---|
642 | "infos" TEXT, |
---|
643 | PRIMARY KEY ("id") |
---|
644 | ); |
---|
645 | |
---|
646 | COMMENT ON TABLE "piwigo_waiting" IS ''; |
---|
647 | |
---|
648 | |
---|
649 | SET search_path TO public; |
---|