media in comments, part 1: the admin side
[mir.git] / dbscripts / create_pg.sql
1 --
2 -- Selected TOC Entries:
3 --
4 --
5 -- TOC Entry ID 2 (OID 19796)
6 --
7 -- Name: media_id_seq Type: SEQUENCE Owner: postgres
8 --
9
10 CREATE SEQUENCE "media_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
11
12 --
13 -- TOC Entry ID 3 (OID 19815)
14 --
15 -- Name: media_folder_id_seq Type: SEQUENCE Owner: postgres
16 --
17
18 CREATE SEQUENCE "media_folder_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
19
20 --
21 -- TOC Entry ID 4 (OID 19834)
22 --
23 -- Name: feature_id_seq Type: SEQUENCE Owner: postgres
24 --
25
26 CREATE SEQUENCE "feature_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
27
28 --
29 -- TOC Entry ID 5 (OID 19853)
30 --
31 -- Name: topic_id_seq Type: SEQUENCE Owner: postgres
32 --
33
34 CREATE SEQUENCE "topic_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
35
36 --
37 -- TOC Entry ID 6 (OID 19872)
38 --
39 -- Name: webdb_users_id_seq Type: SEQUENCE Owner: postgres
40 --
41
42 CREATE SEQUENCE "webdb_users_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
43
44 --
45 -- TOC Entry ID 7 (OID 19891)
46 --
47 -- Name: comment_id_seq Type: SEQUENCE Owner: postgres
48 --
49
50 CREATE SEQUENCE "comment_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
51
52 --
53 -- TOC Entry ID 8 (OID 19910)
54 --
55 -- Name: breaking_id_seq Type: SEQUENCE Owner: postgres
56 --
57
58 CREATE SEQUENCE "breaking_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
59
60 --
61 -- TOC Entry ID 9 (OID 19929)
62 --
63 -- Name: messages_id_seq Type: SEQUENCE Owner: postgres
64 --
65
66 CREATE SEQUENCE "messages_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
67
68 --
69 -- TOC Entry ID 10 (OID 19948)
70 --
71 -- Name: media_type_id_seq Type: SEQUENCE Owner: postgres
72 --
73
74 CREATE SEQUENCE "media_type_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
75
76 --
77 -- TOC Entry ID 12 (OID 19967)
78 --
79 -- Name: media_folder Type: TABLE Owner: postgres
80 --
81
82 CREATE TABLE "media_folder" (
83         "id" integer DEFAULT nextval('media_folder_id_seq'::text) NOT NULL,
84         "name" character varying(255) NOT NULL,
85         "date" character(8) NOT NULL,
86         "place" character varying(80),
87         "keywords" text,
88         "comment" text,
89         "webdb_create" timestamp with time zone NOT NULL,
90         "webdb_lastchange" timestamp with time zone
91 );
92
93 --
94 -- TOC Entry ID 13 (OID 20000)
95 --
96 -- Name: media_type Type: TABLE Owner: postgres
97 --
98
99 CREATE TABLE "media_type" (
100         "id" integer DEFAULT nextval('media_type_id_seq'::text) NOT NULL,
101         "name" character varying(80) NOT NULL,
102         "mime_type" character varying(40) NOT NULL,
103         "classname" character varying(80) NOT NULL,
104         "tablename" character varying(80) NOT NULL,
105         "dcname" character varying(20)
106 );
107
108 --
109 -- TOC Entry ID 14 (OID 20016)
110 --
111 -- Name: img_format Type: TABLE Owner: postgres
112 --
113
114 CREATE TABLE "img_format" (
115         "id" smallint NOT NULL,
116         "name" character varying(20) NOT NULL,
117         "extension" character varying(10) NOT NULL,
118         "mimetype" character varying(40) NOT NULL,
119         "commment" character varying(255)
120 );
121
122 --
123 -- TOC Entry ID 15 (OID 20030)
124 --
125 -- Name: img_layout Type: TABLE Owner: postgres
126 --
127
128 CREATE TABLE "img_layout" (
129         "id" smallint NOT NULL,
130         "name" character varying(20) NOT NULL
131 );
132
133 --
134 -- TOC Entry ID 16 (OID 20041)
135 --
136 -- Name: img_type Type: TABLE Owner: postgres
137 --
138
139 CREATE TABLE "img_type" (
140         "id" smallint NOT NULL,
141         "name" character varying(30) NOT NULL
142 );
143
144 --
145 -- TOC Entry ID 17 (OID 20052)
146 --
147 -- Name: img_color Type: TABLE Owner: postgres
148 --
149
150 CREATE TABLE "img_color" (
151         "id" smallint NOT NULL,
152         "name" character varying(30) NOT NULL
153 );
154
155
156 -- language
157
158 CREATE SEQUENCE "language_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
159
160 CREATE TABLE "language" (
161         "id" integer DEFAULT nextval('language_id_seq') NOT NULL,
162   "name" character varying(40) NOT NULL,
163   "code" character varying(2) NOT NULL,
164   Constraint "language_pkey" Primary Key ("id")
165 );
166
167 --
168 -- TOC Entry ID 19 (OID 20078)
169 --
170 -- Name: rights Type: TABLE Owner: postgres
171 --
172
173 CREATE TABLE "rights" (
174         "id" integer NOT NULL,
175         "name" character varying(80) NOT NULL,
176         "description" text,
177         Constraint "rights_pkey" Primary Key ("id")
178 );
179
180 --
181 -- TOC Entry ID 20 (OID 20108)
182 --
183 -- Name: feature Type: TABLE Owner: postgres
184 --
185
186 CREATE TABLE "feature" (
187         "id" integer DEFAULT nextval('feature_id_seq'::text) NOT NULL,
188         "title" character varying(80) NOT NULL,
189         "description" text,
190         "filename" character varying(20) NOT NULL,
191         "main_url" character varying(255),
192         "is_published" boolean DEFAULT '0' NOT NULL,
193         Constraint "feature_pkey" Primary Key ("id")
194 );
195
196 --
197 -- TOC Entry ID 21 (OID 20143)
198 --
199 -- Name: webdb_users Type: TABLE Owner: postgres
200 --
201
202 CREATE TABLE "webdb_users" (
203         "id" integer DEFAULT nextval('webdb_users_id_seq'::text) NOT NULL,
204         "login" character varying(16) NOT NULL,
205         "password" character varying(16) NOT NULL,
206         "is_admin" boolean DEFAULT '0' NOT NULL,
207         Constraint "webdb_users_pkey" Primary Key ("id")
208 );
209
210 --
211 -- TOC Entry ID 22 (OID 20161)
212 --
213 -- Name: content_x_topic Type: TABLE Owner: postgres
214 --
215
216 CREATE TABLE "content_x_topic" (
217         "content_id" integer NOT NULL,
218         "topic_id" integer NOT NULL
219 );
220
221 -- article type
222
223 CREATE SEQUENCE "article_type_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
224
225 CREATE TABLE "article_type" (
226         "id" integer DEFAULT nextval('article_type_id_seq') NOT NULL,
227         "name" character varying(40) NOT NULL,
228         CONSTRAINT "article_type_pkey" PRIMARY KEY ("id")
229 );
230
231 --
232 -- TOC Entry ID 24 (OID 20183)
233 --
234 -- Name: topic Type: TABLE Owner: postgres
235 --
236
237 CREATE TABLE "topic" (
238         "id" integer DEFAULT nextval('topic_id_seq'::text) NOT NULL,
239         "parent_id" integer DEFAULT '0' NOT NULL,
240         "title" character varying(80) NOT NULL,
241         "description" text,
242         "filename" character varying(20) NOT NULL,
243         "main_url" character varying(255),
244         "archiv_url" character varying(255),
245         Constraint "topic_pkey" Primary Key ("id")
246 );
247
248 --
249 -- TOC Entry ID 25 (OID 20219)
250 --
251 -- Name: comment Type: TABLE Owner: postgres
252 --
253
254 CREATE TABLE "comment" (
255         "id" integer DEFAULT nextval('comment_id_seq'::text) NOT NULL,
256         "title" character varying(80) NOT NULL,
257         "creator" character varying(80) NOT NULL,
258         "description" text NOT NULL,
259         "main_url" character varying(255),
260         "email" character varying(80),
261         "address" character varying(80),
262         "phone" character varying(20),
263         "webdb_create" timestamp with time zone NOT NULL,
264         "webdb_lastchange" timestamp with time zone,
265         "is_published" boolean DEFAULT '1' NOT NULL,
266         "to_language" integer DEFAULT '0' NOT NULL,
267         "to_media" integer NOT NULL,
268         "to_comment_status" smallint,
269         "checksum" integer,
270         "is_html" boolean DEFAULT '0' NOT NULL,
271         Constraint "comment_pkey" Primary Key ("id")
272 );
273
274 --
275 -- TOC Entry ID 26 (OID 20266)
276 --
277 -- Name: media Type: TABLE Owner: postgres
278 --
279
280 CREATE TABLE "media" (
281         "id" integer DEFAULT nextval('media_id_seq'::text) NOT NULL,
282         "title" character varying(80) NOT NULL,
283         "subtitle" character varying(30),
284         "edittitle" character varying(30),
285         "date" character(8) NOT NULL,
286         "creator" character varying(80),
287         "creator_main_url" character varying(255),
288         "creator_email" character varying(80),
289         "creator_address" character varying(80),
290         "creator_phone" character varying(20),
291         "description" text,
292         "keywords" text,
293         "comment" text,
294         "source" character varying(255),
295         "publish_date" timestamp with time zone,
296         "publish_server" character varying(255),
297         "publish_path" character varying(255),
298         "is_published" boolean DEFAULT '0' NOT NULL,
299         "is_produced" boolean DEFAULT '0' NOT NULL,
300         "to_feature" integer DEFAULT '0' NOT NULL,
301         "to_media_folder" integer DEFAULT '0' NOT NULL,
302         "to_media_type" smallint DEFAULT '0' NOT NULL,
303         "to_publisher" integer NOT NULL,
304         "to_language" integer DEFAULT '0',
305         "to_rights" integer DEFAULT '0',
306         "webdb_create" timestamp with time zone NOT NULL,
307         "webdb_lastchange" timestamp with time zone,
308         "to_media" integer
309 );
310
311 --
312 -- TOC Entry ID 27 (OID 20326)
313 --
314 -- Name: uploaded_media Type: TABLE Owner: postgres
315 --
316
317 CREATE TABLE "uploaded_media" (
318         "icon_is_produced" boolean DEFAULT '0' NOT NULL,
319         "icon_path" character varying(255),
320         "size" integer
321 )
322 INHERITS ("media");
323
324 --
325 -- TOC Entry ID 28 (OID 20392)
326 --
327 -- Name: images Type: TABLE Owner: postgres
328 --
329
330 CREATE TABLE "images" (
331         "image_data" oid,
332         "icon_data" oid,
333         "year" character varying(40),
334         "img_width" smallint,
335         "img_height" smallint,
336         "to_img_format" smallint DEFAULT '0' NOT NULL,
337         "to_img_layout" smallint DEFAULT '0' NOT NULL,
338         "to_img_type" smallint DEFAULT '0' NOT NULL,
339         "to_img_color" smallint DEFAULT '0' NOT NULL,
340         "icon_width" smallint,
341         "icon_height" smallint
342 )
343 INHERITS ("uploaded_media");
344
345 --
346 -- TOC Entry ID 29 (OID 20474)
347 --
348 -- Name: content Type: TABLE Owner: postgres
349 --
350
351 CREATE TABLE "content" (
352         "content_data" text,
353         "link_url" character varying(255),
354         "is_html" boolean DEFAULT '0' NOT NULL,
355         "is_stored" boolean DEFAULT '0' NOT NULL,
356         "to_article_type" smallint DEFAULT '0' NOT NULL,
357         "to_content" integer,
358         "checksum" integer
359 )
360 INHERITS ("media");
361
362 --
363 -- TOC Entry ID 30 (OID 20549)
364 --
365 -- Name: breaking Type: TABLE Owner: postgres
366 --
367
368 CREATE TABLE "breaking" (
369         "id" integer DEFAULT nextval('breaking_id_seq'::text) NOT NULL,
370         "text" character varying(255) NOT NULL,
371         "webdb_create" timestamp with time zone NOT NULL
372 );
373
374 --
375 -- TOC Entry ID 31 (OID 20562)
376 --
377 -- Name: messages Type: TABLE Owner: postgres
378 --
379
380 CREATE TABLE "messages" (
381         "id" integer DEFAULT nextval('messages_id_seq'::text) NOT NULL,
382         "title" character varying(30),
383         "description" character varying(255) NOT NULL,
384         "creator" character varying(30) NOT NULL,
385         "webdb_create" timestamp with time zone NOT NULL
386 );
387
388
389 -- comment_status
390
391 CREATE SEQUENCE "comment_status_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
392
393 CREATE TABLE "comment_status" (
394   "id" integer DEFAULT nextval('comment_status_id_seq') NOT NULL,
395   "name" character varying(40) NOT NULL,
396   CONSTRAINT "comment_status_pkey" PRIMARY KEY ("id")
397 );
398
399
400 --
401 -- TOC Entry ID 33 (OID 20588)
402 --
403 -- Name: content_x_media Type: TABLE Owner: postgres
404 --
405
406 CREATE TABLE "content_x_media" (
407         "content_id" integer,
408         "media_id" integer
409 );
410
411 --
412 -- TOC Entry ID 11 (OID 20599)
413 --
414 -- Name: links_imcs_id_seq Type: SEQUENCE Owner: postgres
415 --
416
417 CREATE SEQUENCE "links_imcs_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;
418
419 --
420 -- TOC Entry ID 34 (OID 20618)
421 --
422 -- Name: links_imcs Type: TABLE Owner: postgres
423 --
424
425 CREATE TABLE "links_imcs" (
426         "id" integer DEFAULT nextval('links_imcs_id_seq'::text) NOT NULL,
427         "to_parent_id" integer,
428         "title" character varying(80) NOT NULL,
429         "url" character varying(255) NOT NULL,
430         "sortpriority" integer DEFAULT '1',
431         "to_language" integer DEFAULT '0' NOT NULL,
432         Constraint "links_imcs_pkey" Primary Key ("id")
433 );
434
435 --
436 -- TOC Entry ID 35 (OID 37215)
437 --
438 -- Name: audio Type: TABLE Owner: postgres
439 --
440
441 CREATE TABLE "audio" (
442         "kbits" smallint
443 )
444 INHERITS ("uploaded_media");
445
446 --
447 -- TOC Entry ID 36 (OID 37284)
448 --
449 -- Name: video Type: TABLE Owner: postgres
450 --
451
452 CREATE TABLE "video" (
453 )
454 INHERITS ("uploaded_media");
455
456 --
457 -- TOC Entry ID 37 (OID 45396)
458 --
459 -- Name: other_media Type: TABLE Owner: postgres
460 --
461
462 CREATE TABLE "other_media" (
463         
464 )
465 INHERITS ("uploaded_media");
466
467 --
468 -- TOC Entry ID 40 (OID 20143)
469 --
470 -- Name: "idx_webdb_user_log_pas_is_admin" Type: INDEX Owner: postgres
471 --
472
473 CREATE  INDEX "idx_webdb_user_log_pas_is_admin" on "webdb_users" using btree ( "login" "varchar_ops", "password" "varchar_ops", "is_admin" "bool_ops" );
474
475 --
476 -- TOC Entry ID 41 (OID 20143)
477 --
478 -- Name: "idx_webdb_user_log_pas" Type: INDEX Owner: postgres
479 --
480
481 CREATE  INDEX "idx_webdb_user_log_pas" on "webdb_users" using btree ( "login" "varchar_ops", "password" "varchar_ops" );
482
483 --
484 -- TOC Entry ID 42 (OID 20161)
485 --
486 -- Name: "idx_content" Type: INDEX Owner: postgres
487 --
488
489 CREATE UNIQUE INDEX "idx_content" on "content_x_topic" using btree ( "content_id" "int4_ops", "topic_id" "int4_ops" );
490
491 --
492 -- TOC Entry ID 43 (OID 20161)
493 --
494 -- Name: "idx_topic" Type: INDEX Owner: postgres
495 --
496
497 CREATE UNIQUE INDEX "idx_topic" on "content_x_topic" using btree ( "topic_id" "int4_ops", "content_id" "int4_ops" );
498
499 --
500 -- TOC Entry ID 44 (OID 20183)
501 --
502 -- Name: "idx_topic_title" Type: INDEX Owner: postgres
503 --
504
505 CREATE  INDEX "idx_topic_title" on "topic" using btree ( "title" "varchar_ops" );
506
507 --
508 -- TOC Entry ID 45 (OID 20183)
509 --
510 -- Name: "idx_topic_id" Type: INDEX Owner: postgres
511 --
512
513 CREATE UNIQUE INDEX "idx_topic_id" on "topic" using btree ( "id" "int4_ops" );
514
515 --
516 -- TOC Entry ID 38 (OID 20219)
517 --
518 -- Name: "comment_checksum_index" Type: INDEX Owner: postgres
519 --
520
521 CREATE  INDEX "comment_checksum_index" on "comment" using btree ( "checksum" "int4_ops" );
522
523 --
524 -- TOC Entry ID 46 (OID 20219)
525 --
526 -- Name: "idx_comment_to_media" Type: INDEX Owner: postgres
527 --
528
529 CREATE  INDEX "idx_comment_to_media" on "comment" using btree ( "to_media" "int4_ops" );
530
531
532 create index idx_comment_webdb_create on comment(webdb_create);
533
534
535
536 --
537
538 --
539 -- TOC Entry ID 59 (OID 20326)
540 --
541 -- Name: "idx_uploaded_media_id" Type: INDEX Owner: postgres
542 --
543
544 CREATE UNIQUE INDEX "idx_uploaded_media_id" on "uploaded_media" using btree ( "id" "int4_ops" );
545
546 --
547 -- TOC Entry ID 60 (OID 20326)
548 --
549 -- Name: "idx_uploaded_media_is_published" Type: INDEX Owner: postgres
550 --
551
552 CREATE UNIQUE INDEX "idx_uploaded_media_is_published" on "uploaded_media" using btree ( "id" "int4_ops", "is_published" "bool_ops" );
553
554 --
555 -- TOC Entry ID 47 (OID 20392)
556 --
557 -- Name: "idx_images_is_published__icon_i" Type: INDEX Owner: postgres
558 --
559
560 CREATE  INDEX "idx_images_is_published__icon_i" on "images" using btree ( "is_published" "bool_ops", "icon_is_produced" "bool_ops" );
561
562 --
563 -- TOC Entry ID 48 (OID 20392)
564 --
565 -- Name: "idx_images_id" Type: INDEX Owner: postgres
566 --
567
568 CREATE UNIQUE INDEX "idx_images_id" on "images" using btree ( "id" "int4_ops" );
569
570 --
571 -- TOC Entry ID 39 (OID 20474)
572 --
573 -- Name: "content_checksum_index" Type: INDEX Owner: postgres
574 --
575
576 CREATE  INDEX "content_checksum_index" on "content" using btree ( "checksum" "int4_ops" );
577
578 --
579 -- TOC Entry ID 49 (OID 20474)
580 --
581 -- Name: "idx_content_to_article_type" Type: INDEX Owner: postgres
582 --
583
584 CREATE  INDEX "idx_content_to_article_type" on "content" using btree ( "to_article_type" "int2_ops" );
585
586 --
587 -- TOC Entry ID 50 (OID 20474)
588 --
589 -- Name: "idx_content_is_produced" Type: INDEX Owner: postgres
590 --
591
592 CREATE  INDEX "idx_content_is_produced" on "content" using btree ( "is_produced" "bool_ops" );
593
594 --
595 -- TOC Entry ID 51 (OID 20474)
596 --
597 -- Name: "idx_content_is_published__to_ar" Type: INDEX Owner: postgres
598 --
599
600 CREATE  INDEX "idx_content_is_published__to_ar" on "content" using btree ( "is_published" "bool_ops", "to_article_type" "int2_ops" );
601
602 --
603 -- TOC Entry ID 52 (OID 20474)
604 --
605 -- Name: "idx_content_is_stored" Type: INDEX Owner: postgres
606 --
607
608 CREATE  INDEX "idx_content_is_stored" on "content" using btree ( "is_stored" "bool_ops" );
609
610 --
611 -- TOC Entry ID 53 (OID 20474)
612 --
613 -- Name: "idx_content_is_published__id" Type: INDEX Owner: postgres
614 --
615
616 CREATE  INDEX "idx_content_is_published__id" on "content" using btree ( "is_published" "bool_ops", "id" "int4_ops" );
617
618 --
619 -- TOC Entry ID 54 (OID 20474)
620 --
621 -- Name: "idx_content_is_pub__to_art__to_" Type: INDEX Owner: postgres
622 --
623
624 CREATE  INDEX "idx_content_is_pub__to_art__to_" on "content" using btree ( "is_published" "bool_ops", "to_article_type" "int2_ops", "id" "int4_ops" );
625
626 --
627 -- TOC Entry ID 55 (OID 20474)
628 --
629 -- Name: "idx_content_id" Type: INDEX Owner: postgres
630 --
631
632 CREATE UNIQUE INDEX "idx_content_id" on "content" using btree ( "id" "int4_ops" );
633
634 --
635 -- TOC Entry ID 56 (OID 20588)
636 --
637 -- Name: "idx_content_media" Type: INDEX Owner: postgres
638 --
639
640 CREATE UNIQUE INDEX "idx_content_media" on "content_x_media" using btree ( "content_id" "int4_ops", "media_id" "int4_ops" );
641
642 --
643 -- TOC Entry ID 57 (OID 20588)
644 --
645 -- Name: "idx_media_content" Type: INDEX Owner: postgres
646 --
647
648 CREATE UNIQUE INDEX "idx_media_content" on "content_x_media" using btree ( "media_id" "int4_ops", "content_id" "int4_ops" );
649
650 --
651 -- TOC Entry ID 62 (OID 37215)
652 --
653 -- Name: "idx_audio_is_published_produced" Type: INDEX Owner: postgres
654 --
655
656 CREATE  INDEX "idx_audio_is_published_produced" on "audio" using btree ( "is_published" "bool_ops", "is_produced" "bool_ops" );
657
658 --
659 -- TOC Entry ID 64 (OID 37215)
660 --
661 -- Name: "idx_audio_id" Type: INDEX Owner: postgres
662 --
663
664 CREATE UNIQUE INDEX "idx_audio_id" on "audio" using btree ( "id" "int4_ops" );
665
666 --
667 -- TOC Entry ID 65 (OID 37215)
668 --
669 -- Name: "idx_video_id" Type: INDEX Owner: postgres
670 --
671
672 CREATE UNIQUE INDEX "idx_video_id" on "audio" using btree ( "id" "int4_ops" );
673
674 --
675 -- TOC Entry ID 63 (OID 37284)
676 --
677 -- Name: "idx_video_is_published_produced" Type: INDEX Owner: postgres
678 --
679
680 CREATE  INDEX "idx_video_is_published_produced" on "video" using btree ( "is_published" "bool_ops", "is_produced" "bool_ops" );
681
682
683 --
684 -- TOC Entry ID 37 (OID 520246)
685 --
686 -- Name: "idx_content_is_published" Type: INDEX Owner: postgres
687 --
688
689 CREATE  INDEX "idx_content_is_published" on "content" using btree ( "is_published" "bool_ops" );
690
691 --
692 -- TOC Entry ID 47 (OID 465036)
693 --
694 -- Name: "idx_comment_tomedia_ispublished" Type: INDEX Owner: postgres
695 --
696
697 CREATE  INDEX "idx_comment_tomedia_ispublished" on "comment" using btree ( "to_media" "int4_ops", "is_published" "bool_ops" );
698
699 CREATE UNIQUE INDEX "idx_comment_id" on "comment" using btree ( "id" "int4_ops" );
700
701 CREATE TABLE "comment_x_media" (
702    "comment_id" integer,
703    "media_id" integer
704 );
705
706 CREATE UNIQUE INDEX idx_comment_media on comment_x_media (comment_id, media_id);
707 CREATE UNIQUE INDEX idx_media_comment on comment_x_media (media_id, comment_id);