· 8 years ago · Jan 15, 2018, 09:10 AM
1--
2-- PostgreSQL database dump
3--
4
5-- Dumped from database version 10.1
6-- Dumped by pg_dump version 10.1
7
8SET statement_timeout = 0;
9SET lock_timeout = 0;
10SET idle_in_transaction_session_timeout = 0;
11SET client_encoding = 'UTF8';
12SET standard_conforming_strings = on;
13SET check_function_bodies = false;
14SET client_min_messages = warning;
15SET row_security = off;
16
17--
18-- Name: batoto; Type: SCHEMA; Schema: -; Owner: manga
19--
20
21CREATE SCHEMA batoto;
22
23
24ALTER SCHEMA batoto OWNER TO manga;
25
26--
27-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
28--
29
30CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
31
32
33--
34-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
35--
36
37COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
38
39
40SET search_path = public, pg_catalog;
41
42--
43-- Name: language; Type: TYPE; Schema: public; Owner: postgres
44--
45
46CREATE TYPE language AS ENUM (
47 'English',
48 'Spanish',
49 'French',
50 'German',
51 'Portuguese',
52 'Turkish',
53 'Indonesian',
54 'Greek',
55 'Filipino',
56 'Italian',
57 'Polish',
58 'Thai',
59 'Malay',
60 'Hungarian',
61 'Romanian',
62 'Arabic',
63 'Hebrew',
64 'Russian',
65 'Vietnamese',
66 'Dutch',
67 'Bengali',
68 'Persian',
69 'Czech',
70 'Brazilian',
71 'Bulgarian',
72 'Danish',
73 'Esperanto',
74 'Swedish',
75 'Lithuanian',
76 'Other'
77);
78
79
80ALTER TYPE language OWNER TO postgres;
81
82--
83-- Name: status; Type: TYPE; Schema: public; Owner: postgres
84--
85
86CREATE TYPE status AS ENUM (
87 'Stalled',
88 'Discontinued',
89 'Ongoing',
90 'Complete'
91);
92
93
94ALTER TYPE status OWNER TO postgres;
95
96--
97-- Name: type; Type: TYPE; Schema: public; Owner: postgres
98--
99
100CREATE TYPE type AS ENUM (
101 'Manga (Japanese)',
102 'Manhwa (Korean)',
103 'Webcomic (Japanese)',
104 'Webcomic (Korean)'
105);
106
107
108ALTER TYPE type OWNER TO postgres;
109
110SET default_tablespace = '';
111
112SET default_with_oids = false;
113
114--
115-- Name: groups_scanlation; Type: TABLE; Schema: public; Owner: manga
116--
117
118CREATE TABLE groups_scanlation (
119 name text NOT NULL,
120 description text NOT NULL,
121 release_delay integer
122);
123
124
125ALTER TABLE groups_scanlation OWNER TO manga;
126
127--
128-- Name: TABLE groups_scanlation; Type: COMMENT; Schema: public; Owner: manga
129--
130
131COMMENT ON TABLE groups_scanlation IS 'Describes scanlation groups; groups who scan and translate series.';
132
133
134--
135-- Name: COLUMN groups_scanlation.name; Type: COMMENT; Schema: public; Owner: manga
136--
137
138 'Webcomic (Korean)'
139);
140
141
142ALTER TYPE type OWNER TO postgres;
143
144SET default_tablespace = '';
145
146SET default_with_oids = false;
147
148--
149-- Name: groups_scanlation; Type: TABLE; Schema: public; Owner: manga
150--
151
152CREATE TABLE groups_scanlation (
153 name text NOT NULL,
154 description text NOT NULL,
155 release_delay integer
156);
157
158
159ALTER TABLE groups_scanlation OWNER TO manga;
160
161--
162-- Name: TABLE groups_scanlation; Type: COMMENT; Schema: public; Owner: manga
163--
164
165COMMENT ON TABLE groups_scanlation IS 'Describes scanlation groups; groups who scan and translate series.';
166
167
168--
169-- Name: COLUMN groups_scanlation.name; Type: COMMENT; Schema: public; Owner: manga
170--
171
172COMMENT ON COLUMN groups_scanlation.name IS 'Name to refer to the scanlation group by.';
173
174
175--
176-- Name: COLUMN groups_scanlation.description; Type: COMMENT; Schema: public; Owner: manga
177--
178
179COMMENT ON COLUMN groups_scanlation.description IS 'Human readable description for the scanlation group.';
180
181
182--
183-- Name: COLUMN groups_scanlation.release_delay; Type: COMMENT; Schema: public; Owner: manga
184--
185COMMENT ON COLUMN groups_scanlation.name IS 'Name to refer to the scanlation group by.';
186
187
188--
189-- Name: COLUMN groups_scanlation.description; Type: COMMENT; Schema: public; Owner: manga
190--
191
192COMMENT ON COLUMN groups_scanlation.description IS 'Human readable description for the scanlation group.';
193
194
195--
196-- Name: COLUMN groups_scanlation.release_delay; Type: COMMENT; Schema: public; Owner: manga
197--
198
199COMMENT ON COLUMN groups_scanlation.release_delay IS 'A fixed delay, counted from the time a chapter is uploaded, before the chapter should be released.';
200
201
202--
203-- Name: groups_scanlation_urls; Type: TABLE; Schema: public; Owner: manga
204--
205
206CREATE TABLE groups_scanlation_urls (
207 group_name text NOT NULL,
208 url text NOT NULL
209);
210
211
212ALTER TABLE groups_scanlation_urls OWNER TO manga;
213
214--
215-- Name: TABLE groups_scanlation_urls; Type: COMMENT; Schema: public; Owner: manga
216--
217
218COMMENT ON TABLE groups_scanlation_urls IS 'URLs belonging to a scanlation group. Might be scanlation group websites, social media pages, etc.';
219
220
221--
222-- Name: COLUMN groups_scanlation_urls.group_name; Type: COMMENT; Schema: public; Owner: manga
223--
224
225COMMENT ON COLUMN groups_scanlation_urls.group_name IS 'Identifies the scanlation group the link belongs to.\n\nHas foreign key relationship with the table of scanlation groups.';
226
227
228--
229-- Name: COLUMN groups_scanlation_urls.url; Type: COMMENT; Schema: public; Owner: manga
230--
231
232COMMENT ON COLUMN groups_scanlation_urls.url IS 'The actual URL associated with the scanlation group.';
233
234
235--
236-- Name: languages; Type: TABLE; Schema: public; Owner: manga
237--
238
239CREATE TABLE languages (
240 name text NOT NULL
241);
242
243
244ALTER TABLE languages OWNER TO manga;
245
246--
247-- Name: TABLE languages; Type: COMMENT; Schema: public; Owner: manga
248--
249
250COMMENT ON TABLE languages IS 'Describes acceptable languages for series chapters.';
251
252
253--
254-- Name: COLUMN languages.name; Type: COMMENT; Schema: public; Owner: manga
255--
256
257COMMENT ON COLUMN languages.name IS 'Contains the name of the language, e.g. "English".';
258
259
260--
261-- Name: series; Type: TABLE; Schema: public; Owner: manga
262--
263
264CREATE TABLE series (
265 id bigint NOT NULL,
266 name text NOT NULL,
267 description text NOT NULL,
268 cover_image text NOT NULL,
269 type_name text NOT NULL,
270 type_demonym text NOT NULL,
271 status text NOT NULL
272);
273
274
275ALTER TABLE series OWNER TO manga;
276
277--
278-- Name: TABLE series; Type: COMMENT; Schema: public; Owner: manga
279--
280
281COMMENT ON TABLE series IS 'Describes manga, manhwa, etc series.';
282
283
284--
285-- Name: COLUMN series.id; Type: COMMENT; Schema: public; Owner: manga
286--
287
288COMMENT ON COLUMN series.id IS 'Unique automatically generated sequential identifier for the series.';
289
290
291--
292-- Name: COLUMN series.name; Type: COMMENT; Schema: public; Owner: manga
293--
294
295COMMENT ON COLUMN series.name IS 'Preferred name to refer to a series by.';
296
297
298--
299-- Name: COLUMN series.description; Type: COMMENT; Schema: public; Owner: manga
300--
301
302COMMENT ON COLUMN series.description IS 'Human readable description of the series.';
303
304
305--
306-- Name: COLUMN series.cover_image; Type: COMMENT; Schema: public; Owner: manga
307--
308
309COMMENT ON COLUMN series.cover_image IS 'IPFS hash for the preferred cover image for the series.';
310
311
312--
313-- Name: COLUMN series.type_name; Type: COMMENT; Schema: public; Owner: manga
314--
315
316COMMENT ON COLUMN series.type_name IS 'Name of the series type; e.g. "Manga" or "Manhwa" or "Webcomic".\n\nHas a foreign key relationship with the table of allowable series types.';
317
318
319--
320-- Name: COLUMN series.type_demonym; Type: COMMENT; Schema: public; Owner: manga
321--
322
323COMMENT ON COLUMN series.type_demonym IS 'Demonym of the series type; e.g. "Japanese" or "Korean".\n\nHas foreign key relationship with the table of allowable series types.';
324
325
326--
327-- Name: COLUMN series.status; Type: COMMENT; Schema: public; Owner: manga
328--
329
330COMMENT ON COLUMN series.status IS 'Status of the series, such as "Complete" or "Stalled".\n\nHas foreign key relationship with the table of allowable statuses.';
331
332
333--
334-- Name: series_aliases; Type: TABLE; Schema: public; Owner: manga
335--
336
337CREATE TABLE series_aliases (
338 series_id bigint NOT NULL,
339 name text NOT NULL
340);
341
342
343ALTER TABLE series_aliases OWNER TO manga;
344
345--
346-- Name: TABLE series_aliases; Type: COMMENT; Schema: public; Owner: manga
347--
348
349COMMENT ON TABLE series_aliases IS 'Contains the alternative names for series.';
350
351
352--
353-- Name: COLUMN series_aliases.series_id; Type: COMMENT; Schema: public; Owner: manga
354--
355
356COMMENT ON COLUMN series_aliases.series_id IS 'Identifies the series the alternative name belongs to.\n\nHas foreign key relationship with the table of series.';
357
358
359--
360-- Name: COLUMN series_aliases.name; Type: COMMENT; Schema: public; Owner: manga
361--
362
363COMMENT ON COLUMN series_aliases.name IS 'Alternative name to refer to the series by.';
364
365
366--
367-- Name: series_chapters; Type: TABLE; Schema: public; Owner: manga
368--
369
370CREATE TABLE series_chapters (
371 id bigint NOT NULL,
372 series_id bigint NOT NULL,
373 title text NOT NULL,
374 chapter_number_absolute integer NOT NULL,
375 chapter_number_volume integer,
376 volume_number integer,
377 chapter_language text NOT NULL,
378 contributor_id bigint,
379 time_uploaded timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
380 hash text NOT NULL
381);
382
383
384ALTER TABLE series_chapters OWNER TO manga;
385
386--
387-- Name: TABLE series_chapters; Type: COMMENT; Schema: public; Owner: manga
388--
389
390COMMENT ON TABLE series_chapters IS 'Describes chapters of a series.';
391
392
393--
394-- Name: COLUMN series_chapters.id; Type: COMMENT; Schema: public; Owner: manga
395--
396
397COMMENT ON COLUMN series_chapters.id IS 'Uniquely identifies the series chapter.\n\nID column is used here rather than a primary key encapsulating the series ID and chapter number because the support for series volumes would make this primary key unduly complicated.';
398
399
400--
401-- Name: COLUMN series_chapters.series_id; Type: COMMENT; Schema: public; Owner: manga
402--
403
404COMMENT ON COLUMN series_chapters.series_id IS 'Identifies the series the chapter belongs to.\n\nHas foreign key relationship with the series table.';
405
406
407--
408-- Name: COLUMN series_chapters.title; Type: COMMENT; Schema: public; Owner: manga
409--
410
411COMMENT ON COLUMN series_chapters.title IS 'Title of the chapter.';
412
413
414--
415-- Name: COLUMN series_chapters.chapter_number_absolute; Type: COMMENT; Schema: public; Owner: manga
416--
417
418COMMENT ON COLUMN series_chapters.chapter_number_absolute IS 'Absolute chapter number; the chapter number relative to the total number of chapters in a series, NOT relative to a volume.';
419
420
421--
422-- Name: COLUMN series_chapters.chapter_number_volume; Type: COMMENT; Schema: public; Owner: manga
423--
424
425COMMENT ON COLUMN series_chapters.chapter_number_volume IS 'Chapter number relative to the number of chapters in a volume. This is the number of the chapter WITHIN the a volume.';
426
427
428--
429-- Name: COLUMN series_chapters.volume_number; Type: COMMENT; Schema: public; Owner: manga
430--
431
432COMMENT ON COLUMN series_chapters.volume_number IS 'The number of the volume the chapter belongs to.';
433
434
435--
436-- Name: COLUMN series_chapters.chapter_language; Type: COMMENT; Schema: public; Owner: manga
437--
438
439COMMENT ON COLUMN series_chapters.chapter_language IS 'Language of the text content of the chapter.\n\nHas foreign key relationship with the languages table.';
440
441
442--
443-- Name: COLUMN series_chapters.contributor_id; Type: COMMENT; Schema: public; Owner: manga
444--
445
446COMMENT ON COLUMN series_chapters.contributor_id IS 'Identifies the user who contributed the chapter.\n\nHas foreign key relationship with the table of users.';
447
448
449--
450-- Name: COLUMN series_chapters.time_uploaded; Type: COMMENT; Schema: public; Owner: manga
451--
452
453COMMENT ON COLUMN series_chapters.time_uploaded IS 'Timestamp of when the chapter was uploaded.\n\nDefaults to current time.';
454
455
456--
457-- Name: COLUMN series_chapters.hash; Type: COMMENT; Schema: public; Owner: manga
458--
459
460COMMENT ON COLUMN series_chapters.hash IS 'IPFS hash of the folder for the series chapter.';
461
462
463--
464-- Name: series_chapters_files; Type: TABLE; Schema: public; Owner: manga
465--
466
467CREATE TABLE series_chapters_files (
468 id bigint NOT NULL,
469 chapter_id bigint NOT NULL,
470 name text NOT NULL
471);
472
473
474ALTER TABLE series_chapters_files OWNER TO manga;
475
476--
477-- Name: TABLE series_chapters_files; Type: COMMENT; Schema: public; Owner: manga
478--
479
480COMMENT ON TABLE series_chapters_files IS 'Describes the files in a chapter''s IPFS folder.\n\nTODO: Someone please justify this table''s existence, as its necessity is not apparent to the schema author.';
481
482
483--
484-- Name: COLUMN series_chapters_files.chapter_id; Type: COMMENT; Schema: public; Owner: manga
485--
486
487COMMENT ON COLUMN series_chapters_files.chapter_id IS 'Identifier for the chapter the file relates to.\n\nHas foreign key relationship with the series_chapters table.';
488
489
490--
491-- Name: COLUMN series_chapters_files.name; Type: COMMENT; Schema: public; Owner: manga
492--
493
494COMMENT ON COLUMN series_chapters_files.name IS 'Semantic name of the file in the chapter''s folder.';
495
496
497--
498-- Name: series_chapters_groups; Type: TABLE; Schema: public; Owner: manga
499--
500
501CREATE TABLE series_chapters_groups (
502 chapter_id bigint NOT NULL,
503 group_name text NOT NULL
504);
505
506
507ALTER TABLE series_chapters_groups OWNER TO manga;
508
509--
510-- Name: TABLE series_chapters_groups; Type: COMMENT; Schema: public; Owner: manga
511--
512
513COMMENT ON TABLE series_chapters_groups IS 'Identifies the scanlation groups a series chapter belongs to.';
514
515
516--
517-- Name: COLUMN series_chapters_groups.chapter_id; Type: COMMENT; Schema: public; Owner: manga
518--
519
520COMMENT ON COLUMN series_chapters_groups.chapter_id IS 'Identifies the chapter that belongs to a given scanlation group.';
521
522
523--
524-- Name: COLUMN series_chapters_groups.group_name; Type: COMMENT; Schema: public; Owner: manga
525--
526
527COMMENT ON COLUMN series_chapters_groups.group_name IS 'Identifies the name of the scanlation group that the chapter belongs to.';
528
529
530--
531-- Name: series_chapters_id_seq; Type: SEQUENCE; Schema: public; Owner: manga
532--
533
534CREATE SEQUENCE series_chapters_id_seq
535 START WITH 1
536 INCREMENT BY 1
537 NO MINVALUE
538 NO MAXVALUE
539 CACHE 1;
540
541
542ALTER TABLE series_chapters_id_seq OWNER TO manga;
543
544--
545-- Name: series_chapters_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: manga
546--
547
548ALTER SEQUENCE series_chapters_id_seq OWNED BY series_chapters.id;
549
550
551--
552-- Name: series_id_seq; Type: SEQUENCE; Schema: public; Owner: manga
553--
554
555CREATE SEQUENCE series_id_seq
556 START WITH 1
557 INCREMENT BY 1
558 NO MINVALUE
559 NO MAXVALUE
560 CACHE 1;
561
562
563ALTER TABLE series_id_seq OWNER TO manga;
564
565--
566-- Name: series_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: manga
567--
568
569ALTER SEQUENCE series_id_seq OWNED BY series.id;
570
571
572--
573-- Name: series_ratings; Type: TABLE; Schema: public; Owner: manga
574--
575
576CREATE TABLE series_ratings (
577 series_id bigint NOT NULL,
578 user_id bigint NOT NULL,
579 rating integer NOT NULL
580);
581
582
583ALTER TABLE series_ratings OWNER TO manga;
584
585--
586-- Name: TABLE series_ratings; Type: COMMENT; Schema: public; Owner: manga
587--
588
589COMMENT ON TABLE series_ratings IS 'Describes ratings of a series that users have made.';
590
591
592--
593-- Name: COLUMN series_ratings.series_id; Type: COMMENT; Schema: public; Owner: manga
594--
595
596COMMENT ON COLUMN series_ratings.series_id IS 'Identifies the series that is being rated.';
597
598
599--
600-- Name: COLUMN series_ratings.user_id; Type: COMMENT; Schema: public; Owner: manga
601--
602
603COMMENT ON COLUMN series_ratings.user_id IS 'Identifies the user that is rating the series.';
604
605
606--
607-- Name: COLUMN series_ratings.rating; Type: COMMENT; Schema: public; Owner: manga
608--
609
610COMMENT ON COLUMN series_ratings.rating IS 'The actual rating of the series, on a yet to be determined scale.';
611
612
613--
614-- Name: series_tags; Type: TABLE; Schema: public; Owner: manga
615--
616
617CREATE TABLE series_tags (
618 series_id bigint NOT NULL,
619 tag_name text NOT NULL,
620 tag_namespace text NOT NULL
621);
622
623
624ALTER TABLE series_tags OWNER TO manga;
625
626--
627-- Name: TABLE series_tags; Type: COMMENT; Schema: public; Owner: manga
628--
629
630COMMENT ON TABLE series_tags IS 'Identifies tags associated with a series.';
631
632
633--
634-- Name: COLUMN series_tags.series_id; Type: COMMENT; Schema: public; Owner: manga
635--
636
637COMMENT ON COLUMN series_tags.series_id IS 'Identifies the series the tag is associated with.\n\nHas foreign key relationship with the table of series.';
638
639
640--
641-- Name: COLUMN series_tags.tag_name; Type: COMMENT; Schema: public; Owner: manga
642--
643
644COMMENT ON COLUMN series_tags.tag_name IS 'Identifies the tag associated with the series.\n\nHas foreign key relationship with the table of tags.';
645
646
647--
648-- Name: COLUMN series_tags.tag_namespace; Type: COMMENT; Schema: public; Owner: manga
649--
650
651COMMENT ON COLUMN series_tags.tag_namespace IS 'Identifies the namespace of the tag associated withh the series.\n\nHas foreign key relationship with the table of tags.';
652
653
654--
655-- Name: statuses; Type: TABLE; Schema: public; Owner: manga
656--
657
658CREATE TABLE statuses (
659 name text NOT NULL
660);
661
662
663ALTER TABLE statuses OWNER TO manga;
664
665--
666-- Name: TABLE statuses; Type: COMMENT; Schema: public; Owner: manga
667--
668
669COMMENT ON TABLE statuses IS 'Describes acceptable statuses for series.';
670
671
672--
673-- Name: COLUMN statuses.name; Type: COMMENT; Schema: public; Owner: manga
674--
675
676COMMENT ON COLUMN statuses.name IS 'Contains the name of the status, e.g. "Complete".';
677
678
679--
680-- Name: tags; Type: TABLE; Schema: public; Owner: manga
681--
682
683CREATE TABLE tags (
684 name text NOT NULL,
685 namespace text NOT NULL
686);
687
688
689ALTER TABLE tags OWNER TO manga;
690
691--
692-- Name: TABLE tags; Type: COMMENT; Schema: public; Owner: manga
693--
694
695COMMENT ON TABLE tags IS 'Describes the acceptable tags for series.';
696
697
698--
699-- Name: COLUMN tags.name; Type: COMMENT; Schema: public; Owner: manga
700--
701
702COMMENT ON COLUMN tags.name IS 'Describes the name of the tag.';
703
704
705--
706-- Name: COLUMN tags.namespace; Type: COMMENT; Schema: public; Owner: manga
707--
708
709COMMENT ON COLUMN tags.namespace IS 'Describes the namespace of the tag.';
710
711
712--
713-- Name: types; Type: TABLE; Schema: public; Owner: manga
714--
715
716CREATE TABLE types (
717 name text NOT NULL,
718 origin_demonym text NOT NULL
719);
720
721
722ALTER TABLE types OWNER TO manga;
723
724--
725-- Name: TABLE types; Type: COMMENT; Schema: public; Owner: manga
726--
727
728COMMENT ON TABLE types IS 'Describes the allowable values for series types. Series types describe both the country of origin for a series, and whether it is a web comic.';
729
730
731--
732-- Name: COLUMN types.name; Type: COMMENT; Schema: public; Owner: manga
733--
734
735COMMENT ON COLUMN types.name IS 'Describes the name of the type of series, e.g. "Manga" or "Manhwa".';
736
737
738--
739-- Name: COLUMN types.origin_demonym; Type: COMMENT; Schema: public; Owner: manga
740--
741
742COMMENT ON COLUMN types.origin_demonym IS 'Describes the demonym for the country of origin for this series type, e.g. "Japanese" or "Korean".';
743
744
745--
746-- Name: users; Type: TABLE; Schema: public; Owner: manga
747--
748
749CREATE TABLE users (
750 id bigint NOT NULL,
751 username text NOT NULL,
752 email text,
753 password_hash bytea NOT NULL
754);
755
756
757ALTER TABLE users OWNER TO manga;
758
759--
760-- Name: TABLE users; Type: COMMENT; Schema: public; Owner: manga
761--
762
763COMMENT ON TABLE users IS 'Describes user accounts for the Batoto replacement site.';
764
765
766--
767-- Name: COLUMN users.id; Type: COMMENT; Schema: public; Owner: manga
768--
769
770COMMENT ON COLUMN users.id IS 'Uniquely identifies the user account.\n\nJustification for an identifier column as opposed to using the username as the primary key is simply because it is considered "good practice" to use identifiers instead.';
771
772
773--
774-- Name: COLUMN users.username; Type: COMMENT; Schema: public; Owner: manga
775--
776
777COMMENT ON COLUMN users.username IS 'Username used as a login credential for the user, as well as a human readable account identifier.';
778
779
780--
781-- Name: COLUMN users.email; Type: COMMENT; Schema: public; Owner: manga
782--
783
784COMMENT ON COLUMN users.email IS 'Email address associated with a user account.';
785
786
787--
788-- Name: COLUMN users.password_hash; Type: COMMENT; Schema: public; Owner: manga
789--
790
791COMMENT ON COLUMN users.password_hash IS 'Hash of the user''s password, used as a login credential. Hash is expected to be a bcrypt hash.';
792
793
794--
795-- Name: users_following_series; Type: TABLE; Schema: public; Owner: manga
796--
797
798CREATE TABLE users_following_series (
799 user_id bigint NOT NULL,
800 series_id bigint NOT NULL
801);
802
803
804ALTER TABLE users_following_series OWNER TO manga;
805
806--
807-- Name: TABLE users_following_series; Type: COMMENT; Schema: public; Owner: manga
808--
809
810COMMENT ON TABLE users_following_series IS 'Describes the series that a user is following.';
811
812
813--
814-- Name: COLUMN users_following_series.user_id; Type: COMMENT; Schema: public; Owner: manga
815--
816
817COMMENT ON COLUMN users_following_series.user_id IS 'Identifies the user that is following a series.';
818
819
820--
821-- Name: COLUMN users_following_series.series_id; Type: COMMENT; Schema: public; Owner: manga
822--
823
824COMMENT ON COLUMN users_following_series.series_id IS 'Identifies the series that the user is following.';
825
826
827--
828-- Name: users_groups; Type: TABLE; Schema: public; Owner: manga
829--
830
831CREATE TABLE users_groups (
832 user_id bigint NOT NULL,
833 group_name text NOT NULL
834);
835
836
837ALTER TABLE users_groups OWNER TO manga;
838
839--
840-- Name: TABLE users_groups; Type: COMMENT; Schema: public; Owner: manga
841--
842
843COMMENT ON TABLE users_groups IS 'Identifies scanlation groups that a user belongs to.';
844
845
846--
847-- Name: COLUMN users_groups.user_id; Type: COMMENT; Schema: public; Owner: manga
848--
849
850COMMENT ON COLUMN users_groups.user_id IS 'Identifies the user that belongs to a given group.';
851
852
853--
854-- Name: COLUMN users_groups.group_name; Type: COMMENT; Schema: public; Owner: manga
855--
856
857COMMENT ON COLUMN users_groups.group_name IS 'Identifies the scanlation group that the user belongs to.';
858
859
860--
861-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: manga
862--
863
864CREATE SEQUENCE users_id_seq
865 START WITH 1
866 INCREMENT BY 1
867 NO MINVALUE
868 NO MAXVALUE
869 CACHE 1;
870
871
872ALTER TABLE users_id_seq OWNER TO manga;
873
874--
875-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: manga
876--
877
878ALTER SEQUENCE users_id_seq OWNED BY users.id;
879
880
881--
882-- Name: series id; Type: DEFAULT; Schema: public; Owner: manga
883--
884
885ALTER TABLE ONLY series ALTER COLUMN id SET DEFAULT nextval('series_id_seq'::regclass);
886
887
888--
889-- Name: series_chapters id; Type: DEFAULT; Schema: public; Owner: manga
890--
891
892ALTER TABLE ONLY series_chapters ALTER COLUMN id SET DEFAULT nextval('series_chapters_id_seq'::regclass);
893
894
895--
896-- Name: users id; Type: DEFAULT; Schema: public; Owner: manga
897--
898
899ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
900
901
902--
903-- Name: series_chapters idx_series_chapters_hash; Type: CONSTRAINT; Schema: public; Owner: manga
904--
905
906ALTER TABLE ONLY series_chapters
907 ADD CONSTRAINT idx_series_chapters_hash UNIQUE (hash);
908
909
910--
911-- Name: CONSTRAINT idx_series_chapters_hash ON series_chapters; Type: COMMENT; Schema: public; Owner: manga
912--
913
914COMMENT ON CONSTRAINT idx_series_chapters_hash ON series_chapters IS 'Indexes the IPFS hash of a chapter.Justification is to be able to identify an otherwise unknown chapter by its IPFS hash.';
915
916
917--
918-- Name: series idx_series_name; Type: CONSTRAINT; Schema: public; Owner: manga
919--
920
921ALTER TABLE ONLY series
922 ADD CONSTRAINT idx_series_name UNIQUE (name);
923
924
925--
926-- Name: CONSTRAINT idx_series_name ON series; Type: COMMENT; Schema: public; Owner: manga
927--
928
929COMMENT ON CONSTRAINT idx_series_name ON series IS 'Index indexing the name of the series.';
930
931
932--
933-- Name: groups_scanlation pk_groups_scanlation_name; Type: CONSTRAINT; Schema: public; Owner: manga
934--
935
936ALTER TABLE ONLY groups_scanlation
937 ADD CONSTRAINT pk_groups_scanlation_name PRIMARY KEY (name);
938
939
940--
941-- Name: groups_scanlation_urls pk_groups_scanlation_urls; Type: CONSTRAINT; Schema: public; Owner: manga
942--
943
944ALTER TABLE ONLY groups_scanlation_urls
945 ADD CONSTRAINT pk_groups_scanlation_urls PRIMARY KEY (group_name, url);
946
947
948--
949-- Name: CONSTRAINT pk_groups_scanlation_urls ON groups_scanlation_urls; Type: COMMENT; Schema: public; Owner: manga
950--
951
952COMMENT ON CONSTRAINT pk_groups_scanlation_urls ON groups_scanlation_urls IS 'Primary key encapsulating the name of the scanlation group that a link is associated with, as well as the link itself.';
953
954
955--
956-- Name: languages pk_languages_name; Type: CONSTRAINT; Schema: public; Owner: manga
957--
958
959ALTER TABLE ONLY languages
960 ADD CONSTRAINT pk_languages_name PRIMARY KEY (name);
961
962
963--
964-- Name: CONSTRAINT pk_languages_name ON languages; Type: COMMENT; Schema: public; Owner: manga
965--
966
967COMMENT ON CONSTRAINT pk_languages_name ON languages IS 'Primary key encapsulating the name of the language.';
968
969
970--
971-- Name: series_aliases pk_series_aliases; Type: CONSTRAINT; Schema: public; Owner: manga
972--
973
974ALTER TABLE ONLY series_aliases
975 ADD CONSTRAINT pk_series_aliases PRIMARY KEY (series_id, name);
976
977
978--
979-- Name: CONSTRAINT pk_series_aliases ON series_aliases; Type: COMMENT; Schema: public; Owner: manga
980--
981
982COMMENT ON CONSTRAINT pk_series_aliases ON series_aliases IS 'Primary key encapsulating the identifier for the series the alias belongs to, and the alias itself.';
983
984
985--
986-- Name: series_chapters_files pk_series_chapters_file; Type: CONSTRAINT; Schema: public; Owner: manga
987--
988
989ALTER TABLE ONLY series_chapters_files
990 ADD CONSTRAINT pk_series_chapters_file PRIMARY KEY (id,chapter_id, name);
991
992
993--
994-- Name: CONSTRAINT pk_series_chapters_file ON series_chapters_files; Type: COMMENT; Schema: public; Owner: manga
995--
996
997COMMENT ON CONSTRAINT pk_series_chapters_file ON series_chapters_files IS 'Primary key encapsulating the identifier of the chapter the file relates to, and the name of the file itself.';
998
999
1000--
1001-- Name: series_chapters_groups pk_series_chapters_groups; Type: CONSTRAINT; Schema: public; Owner: manga
1002--
1003
1004ALTER TABLE ONLY series_chapters_groups
1005 ADD CONSTRAINT pk_series_chapters_groups PRIMARY KEY (chapter_id, group_name);
1006
1007
1008--
1009-- Name: CONSTRAINT pk_series_chapters_groups ON series_chapters_groups; Type: COMMENT; Schema: public; Owner: manga
1010--
1011
1012COMMENT ON CONSTRAINT pk_series_chapters_groups ON series_chapters_groups IS 'Primary key encapsulating the series chapter that belongs to a given group, as well as the group that it belongs to.';
1013
1014
1015--
1016-- Name: series_chapters pk_series_chapters_id; Type: CONSTRAINT; Schema: public; Owner: manga
1017--
1018
1019ALTER TABLE ONLY series_chapters
1020 ADD CONSTRAINT pk_series_chapters_id PRIMARY KEY (id);
1021
1022
1023--
1024-- Name: CONSTRAINT pk_series_chapters_id ON series_chapters; Type: COMMENT; Schema: public; Owner: manga
1025--
1026
1027COMMENT ON CONSTRAINT pk_series_chapters_id ON series_chapters IS 'Primary key encapsulating the unique identifier for the chapter.';
1028
1029
1030--
1031-- Name: series pk_series_id; Type: CONSTRAINT; Schema: public; Owner: manga
1032--
1033
1034ALTER TABLE ONLY series
1035 ADD CONSTRAINT pk_series_id PRIMARY KEY (id);
1036
1037
1038--
1039-- Name: CONSTRAINT pk_series_id ON series; Type: COMMENT; Schema: public; Owner: manga
1040--
1041
1042COMMENT ON CONSTRAINT pk_series_id ON series IS 'Primary key encapsulating the automatically generated unique identifier for the series.';
1043
1044
1045--
1046-- Name: series_ratings pk_series_ratings; Type: CONSTRAINT; Schema: public; Owner: manga
1047--
1048
1049ALTER TABLE ONLY series_ratings
1050 ADD CONSTRAINT pk_series_ratings PRIMARY KEY (series_id, user_id);
1051
1052
1053--
1054-- Name: CONSTRAINT pk_series_ratings ON series_ratings; Type: COMMENT; Schema: public; Owner: manga
1055--
1056
1057COMMENT ON CONSTRAINT pk_series_ratings ON series_ratings IS 'Primary key encapsulating the series identifier for the series being rated, as well as the user identifier for the user rating the series.';
1058
1059
1060--
1061-- Name: series_tags pk_series_tags; Type: CONSTRAINT; Schema: public; Owner: manga
1062--
1063
1064ALTER TABLE ONLY series_tags
1065 ADD CONSTRAINT pk_series_tags PRIMARY KEY (series_id, tag_name, tag_namespace);
1066
1067
1068--
1069-- Name: CONSTRAINT pk_series_tags ON series_tags; Type: COMMENT; Schema: public; Owner: manga
1070--
1071
1072COMMENT ON CONSTRAINT pk_series_tags ON series_tags IS 'Primary key encapsulating the series identifier, tag name, and tag namespace, of the tag<>series association.';
1073
1074
1075--
1076-- Name: statuses pk_statuses_name; Type: CONSTRAINT; Schema: public; Owner: manga
1077--
1078
1079ALTER TABLE ONLY statuses
1080 ADD CONSTRAINT pk_statuses_name PRIMARY KEY (name);
1081
1082
1083--
1084-- Name: CONSTRAINT pk_statuses_name ON statuses; Type: COMMENT; Schema: public; Owner: manga
1085--
1086
1087COMMENT ON CONSTRAINT pk_statuses_name ON statuses IS 'Primary key encapsulating the name of the series status.';
1088
1089
1090--
1091-- Name: tags pk_tags_name_namespace; Type: CONSTRAINT; Schema: public; Owner: manga
1092--
1093
1094ALTER TABLE ONLY tags
1095 ADD CONSTRAINT pk_tags_name_namespace PRIMARY KEY (name, namespace);
1096
1097
1098--
1099-- Name: CONSTRAINT pk_tags_name_namespace ON tags; Type: COMMENT; Schema: public; Owner: manga
1100--
1101
1102COMMENT ON CONSTRAINT pk_tags_name_namespace ON tags IS 'Primary key encapsulating the name and namespace of the tag.';
1103
1104
1105--
1106-- Name: types pk_types; Type: CONSTRAINT; Schema: public; Owner: manga
1107--
1108
1109ALTER TABLE ONLY types
1110 ADD CONSTRAINT pk_types PRIMARY KEY (name, origin_demonym);
1111
1112
1113--
1114-- Name: CONSTRAINT pk_types ON types; Type: COMMENT; Schema: public; Owner: manga
1115--
1116
1117COMMENT ON CONSTRAINT pk_types ON types IS 'Primary key encapsulating both the name of the series type, and the country of origin.';
1118
1119
1120--
1121-- Name: users_following_series pk_users_following_series; Type: CONSTRAINT; Schema: public; Owner: manga
1122--
1123
1124ALTER TABLE ONLY users_following_series
1125 ADD CONSTRAINT pk_users_following_series PRIMARY KEY (user_id, series_id);
1126
1127
1128--
1129-- Name: CONSTRAINT pk_users_following_series ON users_following_series; Type: COMMENT; Schema: public; Owner: manga
1130--
1131
1132COMMENT ON CONSTRAINT pk_users_following_series ON users_following_series IS 'Primary key encapsulating the identifier of the user that is following a series, as well as the identifier of the series that the user is following.';
1133
1134
1135--
1136-- Name: users_groups pk_users_groups; Type: CONSTRAINT; Schema: public; Owner: manga
1137--
1138
1139ALTER TABLE ONLY users_groups
1140 ADD CONSTRAINT pk_users_groups PRIMARY KEY (user_id, group_name);
1141
1142
1143--
1144-- Name: CONSTRAINT pk_users_groups ON users_groups; Type: COMMENT; Schema: public; Owner: manga
1145--
1146
1147COMMENT ON CONSTRAINT pk_users_groups ON users_groups IS 'Primary key encapsulating the user identifier and the scanlation group name that the user belongs to.';
1148
1149
1150--
1151-- Name: users pk_users_id; Type: CONSTRAINT; Schema: public; Owner: manga
1152--
1153
1154ALTER TABLE ONLY users
1155 ADD CONSTRAINT pk_users_id PRIMARY KEY (id);
1156
1157
1158--
1159-- Name: users pk_users_username; Type: CONSTRAINT; Schema: public; Owner: manga
1160--
1161
1162ALTER TABLE ONLY users
1163 ADD CONSTRAINT pk_users_username UNIQUE (username);
1164
1165
1166--
1167-- Name: CONSTRAINT pk_users_username ON users; Type: COMMENT; Schema: public; Owner: manga
1168--
1169
1170COMMENT ON CONSTRAINT pk_users_username ON users IS 'Indexes user accounts'' usernames.Justification is to ensure username uniqueness as well as to enable searching of user accounts by username.';
1171
1172
1173--
1174-- Name: idx_groups_scanlation_description; Type: INDEX; Schema: public; Owner: manga
1175--
1176
1177CREATE INDEX idx_groups_scanlation_description ON groups_scanlation USING btree (description);
1178
1179
1180--
1181-- Name: INDEX idx_groups_scanlation_description; Type: COMMENT; Schema: public; Owner: manga
1182--
1183
1184COMMENT ON INDEX idx_groups_scanlation_description IS 'Indexes the description of a scanlation group.Justification is to make scanlation groups searchabe by their description.';
1185
1186
1187--
1188-- Name: idx_groups_scanlation_links_group_name; Type: INDEX; Schema: public; Owner: manga
1189--
1190
1191CREATE INDEX idx_groups_scanlation_links_group_name ON groups_scanlation_urls USING btree (group_name);
1192
1193
1194--
1195-- Name: idx_groups_scanlation_release_delay; Type: INDEX; Schema: public; Owner: manga
1196--
1197
1198CREATE INDEX idx_groups_scanlation_release_delay ON groups_scanlation USING btree (release_delay);
1199
1200
1201--
1202-- Name: INDEX idx_groups_scanlation_release_delay; Type: COMMENT; Schema: public; Owner: manga
1203--
1204
1205COMMENT ON INDEX idx_groups_scanlation_release_delay IS 'Indexes the release delay for a scanlation group.Justification is to make scanlation groups searchable/sortable by their release delay.';
1206
1207
1208--
1209-- Name: idx_series_aliases_series_id; Type: INDEX; Schema: public; Owner: manga
1210--
1211
1212CREATE INDEX idx_series_aliases_series_id ON series_aliases USING btree (series_id);
1213
1214
1215--
1216-- Name: INDEX idx_series_aliases_series_id; Type: COMMENT; Schema: public; Owner: manga
1217--
1218
1219COMMENT ON INDEX idx_series_aliases_series_id IS 'Index indexing the series identifiers for aliases.Justification is to allow searching of aliases by series identifier.';
1220
1221
1222--
1223-- Name: idx_series_chapters_chapter_language; Type: INDEX; Schema: public; Owner: manga
1224--
1225
1226CREATE INDEX idx_series_chapters_chapter_language ON series_chapters USING btree (chapter_language);
1227
1228
1229--
1230-- Name: idx_series_chapters_chapter_number_absolute; Type: INDEX; Schema: public; Owner: manga
1231--
1232
1233CREATE INDEX idx_series_chapters_chapter_number_absolute ON series_chapters USING btree (chapter_number_absolute);
1234
1235
1236--
1237-- Name: INDEX idx_series_chapters_chapter_number_absolute; Type: COMMENT; Schema: public; Owner: manga
1238--
1239
1240COMMENT ON INDEX idx_series_chapters_chapter_number_absolute IS 'Indexes the absolute chapter number of a series.Justification is to sort by chapter numbers.';
1241
1242
1243--
1244-- Name: idx_series_chapters_chapter_number_volume; Type: INDEX; Schema: public; Owner: manga
1245--
1246
1247CREATE INDEX idx_series_chapters_chapter_number_volume ON series_chapters USING btree (chapter_number_volume);
1248
1249
1250--
1251-- Name: INDEX idx_series_chapters_chapter_number_volume; Type: COMMENT; Schema: public; Owner: manga
1252--
1253
1254COMMENT ON INDEX idx_series_chapters_chapter_number_volume IS 'Indexes the relative (volume) chapter number of a series.Justification is to sort by chapter numbers.';
1255
1256
1257--
1258-- Name: idx_series_chapters_contributor_id; Type: INDEX; Schema: public; Owner: manga
1259--
1260
1261CREATE INDEX idx_series_chapters_contributor_id ON series_chapters USING btree (contributor_id);
1262
1263
1264--
1265-- Name: INDEX idx_series_chapters_contributor_id; Type: COMMENT; Schema: public; Owner: manga
1266--
1267
1268COMMENT ON INDEX idx_series_chapters_contributor_id IS 'Indexes by chapter''s contributor.Justification is to be able to search all chapters contributed by a given user.';
1269
1270
1271--
1272-- Name: idx_series_chapters_files_chapter_id; Type: INDEX; Schema: public; Owner: manga
1273--
1274
1275CREATE INDEX idx_series_chapters_files_chapter_id ON series_chapters_files USING btree (chapter_id);
1276
1277
1278--
1279-- Name: idx_series_chapters_groups_chapter_id; Type: INDEX; Schema: public; Owner: manga
1280--
1281
1282CREATE INDEX idx_series_chapters_groups_chapter_id ON series_chapters_groups USING btree (chapter_id);
1283
1284
1285--
1286-- Name: idx_series_chapters_groups_group_name; Type: INDEX; Schema: public; Owner: manga
1287--
1288
1289CREATE INDEX idx_series_chapters_groups_group_name ON series_chapters_groups USING btree (group_name);
1290
1291
1292--
1293-- Name: idx_series_chapters_series_id; Type: INDEX; Schema: public; Owner: manga
1294--
1295
1296CREATE INDEX idx_series_chapters_series_id ON series_chapters USING btree (series_id);
1297
1298
1299--
1300-- Name: idx_series_chapters_time_uploaded; Type: INDEX; Schema: public; Owner: manga
1301--
1302
1303CREATE INDEX idx_series_chapters_time_uploaded ON series_chapters USING btree (time_uploaded);
1304
1305
1306--
1307-- Name: INDEX idx_series_chapters_time_uploaded; Type: COMMENT; Schema: public; Owner: manga
1308--
1309
1310COMMENT ON INDEX idx_series_chapters_time_uploaded IS 'Indexes the time a chapter was uploaded.Justification is to search by upload time/date.';
1311
1312
1313--
1314-- Name: idx_series_chapters_title; Type: INDEX; Schema: public; Owner: manga
1315--
1316
1317CREATE INDEX idx_series_chapters_title ON series_chapters USING btree (title);
1318
1319
1320--
1321-- Name: INDEX idx_series_chapters_title; Type: COMMENT; Schema: public; Owner: manga
1322--
1323
1324COMMENT ON INDEX idx_series_chapters_title IS 'Indexes the title of the chapter.Is not unique because series may share chapter titles.Justification for index is to make series_chapters searchable by chapter title.';
1325
1326
1327--
1328-- Name: idx_series_chapters_volume_number; Type: INDEX; Schema: public; Owner: manga
1329--
1330
1331CREATE INDEX idx_series_chapters_volume_number ON series_chapters USING btree (volume_number);
1332
1333
1334--
1335-- Name: INDEX idx_series_chapters_volume_number; Type: COMMENT; Schema: public; Owner: manga
1336--
1337
1338COMMENT ON INDEX idx_series_chapters_volume_number IS 'Indexes the volume number of a series.Justification is to sort by volume numbers.';
1339
1340
1341--
1342-- Name: idx_series_description; Type: INDEX; Schema: public; Owner: manga
1343--
1344
1345CREATE INDEX idx_series_description ON series USING btree (description);
1346
1347
1348--
1349-- Name: INDEX idx_series_description; Type: COMMENT; Schema: public; Owner: manga
1350--
1351
1352COMMENT ON INDEX idx_series_description IS 'Index indexing the description of the series.';
1353
1354
1355--
1356-- Name: idx_series_ratings_series_id; Type: INDEX; Schema: public; Owner: manga
1357--
1358
1359CREATE INDEX idx_series_ratings_series_id ON series_ratings USING btree (series_id);
1360
1361
1362--
1363-- Name: INDEX idx_series_ratings_series_id; Type: COMMENT; Schema: public; Owner: manga
1364--
1365
1366COMMENT ON INDEX idx_series_ratings_series_id IS 'Indexes the series identifier the rating relates to.\n\nJustification is to allow searching of ratings by series identifier.';
1367
1368
1369--
1370-- Name: idx_series_ratings_user_id; Type: INDEX; Schema: public; Owner: manga
1371--
1372
1373CREATE INDEX idx_series_ratings_user_id ON series_ratings USING btree (user_id);
1374
1375
1376--
1377-- Name: INDEX idx_series_ratings_user_id; Type: COMMENT; Schema: public; Owner: manga
1378--
1379
1380COMMENT ON INDEX idx_series_ratings_user_id IS 'Indexes the user identifier for a rating.\n\nJustification is to allow searching of ratings by the user who gave the rating.';
1381
1382
1383--
1384-- Name: idx_series_series_type_name; Type: INDEX; Schema: public; Owner: manga
1385--
1386
1387CREATE INDEX idx_series_series_type_name ON series USING btree (type_name);
1388
1389
1390--
1391-- Name: INDEX idx_series_series_type_name; Type: COMMENT; Schema: public; Owner: manga
1392--
1393
1394COMMENT ON INDEX idx_series_series_type_name IS 'Index indexing the name of the series type.';
1395
1396
1397--
1398-- Name: idx_series_status; Type: INDEX; Schema: public; Owner: manga
1399--
1400
1401CREATE INDEX idx_series_status ON series USING btree (status);
1402
1403
1404--
1405-- Name: INDEX idx_series_status; Type: COMMENT; Schema: public; Owner: manga
1406--
1407
1408COMMENT ON INDEX idx_series_status IS 'Index indexing the series status.';
1409
1410
1411--
1412-- Name: idx_series_tags_series_id; Type: INDEX; Schema: public; Owner: manga
1413--
1414
1415CREATE INDEX idx_series_tags_series_id ON series_tags USING btree (series_id);
1416
1417
1418--
1419-- Name: INDEX idx_series_tags_series_id; Type: COMMENT; Schema: public; Owner: manga
1420--
1421
1422COMMENT ON INDEX idx_series_tags_series_id IS 'Indexes the series identifier for the series the tag is being associated with.\n\nJustification is to allow searching tags for all tags assosicated with a series.';
1423
1424
1425--
1426-- Name: idx_series_tags_tag_name; Type: INDEX; Schema: public; Owner: manga
1427--
1428
1429CREATE INDEX idx_series_tags_tag_name ON series_tags USING btree (tag_name);
1430
1431
1432--
1433-- Name: INDEX idx_series_tags_tag_name; Type: COMMENT; Schema: public; Owner: manga
1434--
1435
1436COMMENT ON INDEX idx_series_tags_tag_name IS 'Indexes the tag name for the series-tag association.\n\nJustification is to allow enumerating all series-tag associations by a tag name.';
1437
1438
1439--
1440-- Name: idx_series_tags_tag_name_namespace; Type: INDEX; Schema: public; Owner: manga
1441--
1442
1443CREATE INDEX idx_series_tags_tag_name_namespace ON series_tags USING btree (tag_name, tag_namespace);
1444
1445
1446--
1447-- Name: INDEX idx_series_tags_tag_name_namespace; Type: COMMENT; Schema: public; Owner: manga
1448--
1449
1450COMMENT ON INDEX idx_series_tags_tag_name_namespace IS 'Indexes the tag name and namespace.\n\nJustification is to allow searching for series matching given fully formed tags.';
1451
1452
1453--
1454-- Name: idx_series_tags_tag_namespace; Type: INDEX; Schema: public; Owner: manga
1455--
1456
1457CREATE INDEX idx_series_tags_tag_namespace ON series_tags USING btree (tag_namespace);
1458
1459
1460--
1461-- Name: INDEX idx_series_tags_tag_namespace; Type: COMMENT; Schema: public; Owner: manga
1462--
1463
1464COMMENT ON INDEX idx_series_tags_tag_namespace IS 'Indexes the namespace of the tag associated with the series.\n\nJustification is to allow enumerating all series tags within a given namespace.';
1465
1466
1467--
1468-- Name: idx_series_type_demonym; Type: INDEX; Schema: public; Owner: manga
1469--
1470
1471CREATE INDEX idx_series_type_demonym ON series USING btree (type_demonym);
1472
1473
1474--
1475-- Name: INDEX idx_series_type_demonym; Type: COMMENT; Schema: public; Owner: manga
1476--
1477
1478COMMENT ON INDEX idx_series_type_demonym IS 'Index indexing the demonym of the series type.';
1479
1480
1481--
1482-- Name: idx_users_following_series_series_id; Type: INDEX; Schema: public; Owner: manga
1483--
1484
1485CREATE INDEX idx_users_following_series_series_id ON users_following_series USING btree (series_id);
1486
1487
1488--
1489-- Name: idx_users_following_series_user_id; Type: INDEX; Schema: public; Owner: manga
1490--
1491
1492CREATE INDEX idx_users_following_series_user_id ON users_following_series USING btree (user_id);
1493
1494
1495--
1496-- Name: idx_users_groups_group_name; Type: INDEX; Schema: public; Owner: manga
1497--
1498
1499CREATE INDEX idx_users_groups_group_name ON users_groups USING btree (group_name);
1500
1501
1502--
1503-- Name: idx_users_groups_user_id; Type: INDEX; Schema: public; Owner: manga
1504--
1505
1506CREATE INDEX idx_users_groups_user_id ON users_groups USING btree (user_id);
1507
1508
1509--
1510-- Name: groups_scanlation_urls fk_groups_scanlation_links; Type: FK CONSTRAINT; Schema: public; Owner: manga
1511--
1512
1513ALTER TABLE ONLY groups_scanlation_urls
1514 ADD CONSTRAINT fk_groups_scanlation_links FOREIGN KEY (group_name) REFERENCES groups_scanlation(name) ON UPDATE CASCADE ON DELETE CASCADE;
1515
1516
1517--
1518-- Name: CONSTRAINT fk_groups_scanlation_links ON groups_scanlation_urls; Type: COMMENT; Schema: public; Owner: manga
1519--
1520
1521COMMENT ON CONSTRAINT fk_groups_scanlation_links ON groups_scanlation_urls IS 'Foreign key binding a scanlation group URL to an actual entry in the scanlation groups table.';
1522
1523
1524--
1525-- Name: series_aliases fk_series_aliases_series; Type: FK CONSTRAINT; Schema: public; Owner: manga
1526--
1527
1528ALTER TABLE ONLY series_aliases
1529 ADD CONSTRAINT fk_series_aliases_series FOREIGN KEY (series_id) REFERENCES series(id) ON UPDATE CASCADE ON DELETE CASCADE;
1530
1531
1532--
1533-- Name: CONSTRAINT fk_series_aliases_series ON series_aliases; Type: COMMENT; Schema: public; Owner: manga
1534--
1535
1536COMMENT ON CONSTRAINT fk_series_aliases_series ON series_aliases IS 'Foreign key relationship binding the series alias to a particular series identifier.';
1537
1538
1539--
1540-- Name: series_chapters_files fk_series_chapters_files; Type: FK CONSTRAINT; Schema: public; Owner: manga
1541--
1542
1543ALTER TABLE ONLY series_chapters_files
1544 ADD CONSTRAINT fk_series_chapters_files FOREIGN KEY (chapter_id) REFERENCES series_chapters(id) ON UPDATE CASCADE ON DELETE CASCADE;
1545
1546
1547--
1548-- Name: CONSTRAINT fk_series_chapters_files ON series_chapters_files; Type: COMMENT; Schema: public; Owner: manga
1549--
1550
1551COMMENT ON CONSTRAINT fk_series_chapters_files ON series_chapters_files IS 'Foreign key binding the identifier of a chapter the file relates to, to an actual entry in the series chapters table.';
1552
1553
1554--
1555-- Name: series_chapters_groups fk_series_chapters_groups_chapter_id; Type: FK CONSTRAINT; Schema: public; Owner: manga
1556--
1557
1558ALTER TABLE ONLY series_chapters_groups
1559 ADD CONSTRAINT fk_series_chapters_groups_chapter_id FOREIGN KEY (chapter_id) REFERENCES series_chapters(id) ON UPDATE CASCADE ON DELETE CASCADE;
1560
1561
1562--
1563-- Name: CONSTRAINT fk_series_chapters_groups_chapter_id ON series_chapters_groups; Type: COMMENT; Schema: public; Owner: manga
1564--
1565
1566COMMENT ON CONSTRAINT fk_series_chapters_groups_chapter_id ON series_chapters_groups IS 'Foreign key binding the identifier of a chapter that belongs to a given group, to an actual entry in the series chapters table.';
1567
1568
1569--
1570-- Name: series_chapters_groups fk_series_chapters_groups_group_name; Type: FK CONSTRAINT; Schema: public; Owner: manga
1571--
1572
1573ALTER TABLE ONLY series_chapters_groups
1574 ADD CONSTRAINT fk_series_chapters_groups_group_name FOREIGN KEY (group_name) REFERENCES groups_scanlation(name) ON UPDATE CASCADE;
1575
1576
1577--
1578-- Name: CONSTRAINT fk_series_chapters_groups_group_name ON series_chapters_groups; Type: COMMENT; Schema: public; Owner: manga
1579--
1580
1581COMMENT ON CONSTRAINT fk_series_chapters_groups_group_name ON series_chapters_groups IS 'Foreign key binding the name of a scanlation group that a series chapter belongs to, to an actual entry in the scanlation groups table.';
1582
1583
1584--
1585-- Name: series_chapters fk_series_chapters_languages; Type: FK CONSTRAINT; Schema: public; Owner: manga
1586--
1587
1588ALTER TABLE ONLY series_chapters
1589 ADD CONSTRAINT fk_series_chapters_languages FOREIGN KEY (chapter_language) REFERENCES languages(name) ON UPDATE CASCADE;
1590
1591
1592--
1593-- Name: CONSTRAINT fk_series_chapters_languages ON series_chapters; Type: COMMENT; Schema: public; Owner: manga
1594--
1595
1596COMMENT ON CONSTRAINT fk_series_chapters_languages ON series_chapters IS 'Foreign key relationship binding the language of the series chapter to the languages table.';
1597
1598
1599--
1600-- Name: series_chapters fk_series_chapters_series_id; Type: FK CONSTRAINT; Schema: public; Owner: manga
1601--
1602
1603ALTER TABLE ONLY series_chapters
1604 ADD CONSTRAINT fk_series_chapters_series_id FOREIGN KEY (series_id) REFERENCES series(id) ON UPDATE CASCADE ON DELETE CASCADE;
1605
1606
1607--
1608-- Name: CONSTRAINT fk_series_chapters_series_id ON series_chapters; Type: COMMENT; Schema: public; Owner: manga
1609--
1610
1611COMMENT ON CONSTRAINT fk_series_chapters_series_id ON series_chapters IS 'Foreign key relationship binding the series_id to an entry in the series table.';
1612
1613
1614--
1615-- Name: series_chapters fk_series_chapters_users; Type: FK CONSTRAINT; Schema: public; Owner: manga
1616--
1617
1618ALTER TABLE ONLY series_chapters
1619 ADD CONSTRAINT fk_series_chapters_users FOREIGN KEY (contributor_id) REFERENCES users(id) ON UPDATE CASCADE;
1620
1621
1622--
1623-- Name: CONSTRAINT fk_series_chapters_users ON series_chapters; Type: COMMENT; Schema: public; Owner: manga
1624--
1625
1626COMMENT ON CONSTRAINT fk_series_chapters_users ON series_chapters IS 'Foreign key binding the identifier of a chapter''s contributor, to an actual entry in the users table.';
1627
1628
1629--
1630-- Name: series_ratings fk_series_ratings_series; Type: FK CONSTRAINT; Schema: public; Owner: manga
1631--
1632
1633ALTER TABLE ONLY series_ratings
1634 ADD CONSTRAINT fk_series_ratings_series FOREIGN KEY (series_id) REFERENCES series(id) ON UPDATE CASCADE ON DELETE CASCADE;
1635
1636
1637--
1638-- Name: CONSTRAINT fk_series_ratings_series ON series_ratings; Type: COMMENT; Schema: public; Owner: manga
1639--
1640
1641COMMENT ON CONSTRAINT fk_series_ratings_series ON series_ratings IS 'Foreign key binding the series identifier to an actual entry in the series table. \n\nCascade on update and delete is to prune entries relating to removed series.';
1642
1643
1644--
1645-- Name: series_ratings fk_series_ratings_users; Type: FK CONSTRAINT; Schema: public; Owner: manga
1646--
1647
1648ALTER TABLE ONLY series_ratings
1649 ADD CONSTRAINT fk_series_ratings_users FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE;
1650
1651
1652--
1653-- Name: CONSTRAINT fk_series_ratings_users ON series_ratings; Type: COMMENT; Schema: public; Owner: manga
1654--
1655
1656COMMENT ON CONSTRAINT fk_series_ratings_users ON series_ratings IS 'Foreign key binding the user identifier to an actual entry in the users table. \n\nCascade on delete and update to prune ratings from removed users.';
1657
1658
1659--
1660-- Name: series fk_series_statuses; Type: FK CONSTRAINT; Schema: public; Owner: manga
1661--
1662
1663ALTER TABLE ONLY series
1664 ADD CONSTRAINT fk_series_statuses FOREIGN KEY (status) REFERENCES statuses(name) ON UPDATE CASCADE;
1665
1666
1667--
1668-- Name: CONSTRAINT fk_series_statuses ON series; Type: COMMENT; Schema: public; Owner: manga
1669--
1670
1671COMMENT ON CONSTRAINT fk_series_statuses ON series IS 'Foreign key relationship binding series status to the table of allowable series statuses.';
1672
1673
1674--
1675-- Name: series_tags fk_series_tags_series; Type: FK CONSTRAINT; Schema: public; Owner: manga
1676--
1677
1678ALTER TABLE ONLY series_tags
1679 ADD CONSTRAINT fk_series_tags_series FOREIGN KEY (series_id) REFERENCES series(id) ON UPDATE CASCADE ON DELETE CASCADE;
1680
1681
1682--
1683-- Name: CONSTRAINT fk_series_tags_series ON series_tags; Type: COMMENT; Schema: public; Owner: manga
1684--
1685
1686COMMENT ON CONSTRAINT fk_series_tags_series ON series_tags IS 'Foreign key relationship binding the tag association to a specific series from the series table.';
1687
1688
1689--
1690-- Name: series_tags fk_series_tags_tags; Type: FK CONSTRAINT; Schema: public; Owner: manga
1691--
1692
1693ALTER TABLE ONLY series_tags
1694 ADD CONSTRAINT fk_series_tags_tags FOREIGN KEY (tag_namespace) REFERENCES tags(namespace) ON UPDATE CASCADE ON DELETE CASCADE;
1695
1696
1697--
1698-- Name: CONSTRAINT fk_series_tags_tags ON series_tags; Type: COMMENT; Schema: public; Owner: manga
1699--
1700
1701COMMENT ON CONSTRAINT fk_series_tags_tags ON series_tags IS 'Foreign key relationship binding the association''s tag namespace to an entry in the tags table.';
1702
1703
1704--
1705-- Name: series_tags fk_series_tags_tags_name; Type: FK CONSTRAINT; Schema: public; Owner: manga
1706--
1707
1708ALTER TABLE ONLY series_tags
1709 ADD CONSTRAINT fk_series_tags_tags_name FOREIGN KEY (tag_name) REFERENCES tags(name) ON UPDATE CASCADE ON DELETE CASCADE;
1710
1711
1712--
1713-- Name: CONSTRAINT fk_series_tags_tags_name ON series_tags; Type: COMMENT; Schema: public; Owner: manga
1714--
1715
1716COMMENT ON CONSTRAINT fk_series_tags_tags_name ON series_tags IS 'Foreign key relationship binding the association''s tag name to an entry in the tags table.';
1717
1718
1719--
1720-- Name: users_following_series fk_users_following_series_series_id; Type: FK CONSTRAINT; Schema: public; Owner: manga
1721--
1722
1723ALTER TABLE ONLY users_following_series
1724 ADD CONSTRAINT fk_users_following_series_series_id FOREIGN KEY (series_id) REFERENCES series(id) ON UPDATE CASCADE ON DELETE CASCADE;
1725
1726
1727--
1728-- Name: CONSTRAINT fk_users_following_series_series_id ON users_following_series; Type: COMMENT; Schema: public; Owner: manga
1729--
1730
1731COMMENT ON CONSTRAINT fk_users_following_series_series_id ON users_following_series IS 'Foreign key binding the series identifier to an actual entry in the series table. \n\nCascade on delete and update is to remove following status from series that no longer exist.';
1732
1733
1734--
1735-- Name: users_following_series fk_users_following_series_user_id; Type: FK CONSTRAINT; Schema: public; Owner: manga
1736--
1737
1738ALTER TABLE ONLY users_following_series
1739 ADD CONSTRAINT fk_users_following_series_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE;
1740
1741
1742--
1743-- Name: CONSTRAINT fk_users_following_series_user_id ON users_following_series; Type: COMMENT; Schema: public; Owner: manga
1744--
1745
1746COMMENT ON CONSTRAINT fk_users_following_series_user_id ON users_following_series IS 'Foreign key binding the user identifier to an actual entry in the users table. \n\nCascade on update and delete is to ensure entries for users that are removed are pruned as well.';
1747
1748
1749--
1750-- Name: users_groups fk_users_groups_group_name; Type: FK CONSTRAINT; Schema: public; Owner: manga
1751--
1752
1753ALTER TABLE ONLY users_groups
1754 ADD CONSTRAINT fk_users_groups_group_name FOREIGN KEY (group_name) REFERENCES groups_scanlation(name) ON UPDATE CASCADE ON DELETE CASCADE;
1755
1756
1757--
1758-- Name: CONSTRAINT fk_users_groups_group_name ON users_groups; Type: COMMENT; Schema: public; Owner: manga
1759--
1760
1761COMMENT ON CONSTRAINT fk_users_groups_group_name ON users_groups IS 'Foreign key binding the name of the scanlation group to an actual entry in the scanlation groups table.';
1762
1763
1764--
1765-- Name: users_groups fk_users_groups_users; Type: FK CONSTRAINT; Schema: public; Owner: manga
1766--
1767
1768ALTER TABLE ONLY users_groups
1769 ADD CONSTRAINT fk_users_groups_users FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE;
1770
1771
1772--
1773-- Name: CONSTRAINT fk_users_groups_users ON users_groups; Type: COMMENT; Schema: public; Owner: manga
1774--
1775
1776COMMENT ON CONSTRAINT fk_users_groups_users ON users_groups IS 'Foreign key binding the user identifier to an actual entry in the users table.';
1777
1778
1779--
1780-- PostgreSQL database dump complete
1781--