· 8 years ago · Jan 15, 2018, 04:52 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 chapter_id bigint NOT NULL,
469 name text NOT NULL
470);
471
472
473ALTER TABLE series_chapters_files OWNER TO manga;
474
475--
476-- Name: TABLE series_chapters_files; Type: COMMENT; Schema: public; Owner: manga
477--
478
479COMMENT 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.';
480
481
482--
483-- Name: COLUMN series_chapters_files.chapter_id; Type: COMMENT; Schema: public; Owner: manga
484--
485
486COMMENT 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.';
487
488
489--
490-- Name: COLUMN series_chapters_files.name; Type: COMMENT; Schema: public; Owner: manga
491--
492
493COMMENT ON COLUMN series_chapters_files.name IS 'Semantic name of the file in the chapter''s folder.';
494
495
496--
497-- Name: series_chapters_groups; Type: TABLE; Schema: public; Owner: manga
498--
499
500CREATE TABLE series_chapters_groups (
501 chapter_id bigint NOT NULL,
502 group_name text NOT NULL
503);
504
505
506ALTER TABLE series_chapters_groups OWNER TO manga;
507
508--
509-- Name: TABLE series_chapters_groups; Type: COMMENT; Schema: public; Owner: manga
510--
511
512COMMENT ON TABLE series_chapters_groups IS 'Identifies the scanlation groups a series chapter belongs to.';
513
514
515--
516-- Name: COLUMN series_chapters_groups.chapter_id; Type: COMMENT; Schema: public; Owner: manga
517--
518
519COMMENT ON COLUMN series_chapters_groups.chapter_id IS 'Identifies the chapter that belongs to a given scanlation group.';
520
521
522--
523-- Name: COLUMN series_chapters_groups.group_name; Type: COMMENT; Schema: public; Owner: manga
524--
525
526COMMENT ON COLUMN series_chapters_groups.group_name IS 'Identifies the name of the scanlation group that the chapter belongs to.';
527
528
529--
530-- Name: series_chapters_id_seq; Type: SEQUENCE; Schema: public; Owner: manga
531--
532
533CREATE SEQUENCE series_chapters_id_seq
534 START WITH 1
535 INCREMENT BY 1
536 NO MINVALUE
537 NO MAXVALUE
538 CACHE 1;
539
540
541ALTER TABLE series_chapters_id_seq OWNER TO manga;
542
543--
544-- Name: series_chapters_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: manga
545--
546
547ALTER SEQUENCE series_chapters_id_seq OWNED BY series_chapters.id;
548
549
550--
551-- Name: series_id_seq; Type: SEQUENCE; Schema: public; Owner: manga
552--
553
554CREATE SEQUENCE series_id_seq
555 START WITH 1
556 INCREMENT BY 1
557 NO MINVALUE
558 NO MAXVALUE
559 CACHE 1;
560
561
562ALTER TABLE series_id_seq OWNER TO manga;
563
564--
565-- Name: series_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: manga
566--
567
568ALTER SEQUENCE series_id_seq OWNED BY series.id;
569
570
571--
572-- Name: series_ratings; Type: TABLE; Schema: public; Owner: manga
573--
574
575CREATE TABLE series_ratings (
576 series_id bigint NOT NULL,
577 user_id bigint NOT NULL,
578 rating integer NOT NULL
579);
580
581
582ALTER TABLE series_ratings OWNER TO manga;
583
584--
585-- Name: TABLE series_ratings; Type: COMMENT; Schema: public; Owner: manga
586--
587
588COMMENT ON TABLE series_ratings IS 'Describes ratings of a series that users have made.';
589
590
591--
592-- Name: COLUMN series_ratings.series_id; Type: COMMENT; Schema: public; Owner: manga
593--
594
595COMMENT ON COLUMN series_ratings.series_id IS 'Identifies the series that is being rated.';
596
597
598--
599-- Name: COLUMN series_ratings.user_id; Type: COMMENT; Schema: public; Owner: manga
600--
601
602COMMENT ON COLUMN series_ratings.user_id IS 'Identifies the user that is rating the series.';
603
604
605--
606-- Name: COLUMN series_ratings.rating; Type: COMMENT; Schema: public; Owner: manga
607--
608
609COMMENT ON COLUMN series_ratings.rating IS 'The actual rating of the series, on a yet to be determined scale.';
610
611
612--
613-- Name: series_tags; Type: TABLE; Schema: public; Owner: manga
614--
615
616CREATE TABLE series_tags (
617 series_id bigint NOT NULL,
618 tag_name text NOT NULL,
619 tag_namespace text NOT NULL
620);
621
622
623ALTER TABLE series_tags OWNER TO manga;
624
625--
626-- Name: TABLE series_tags; Type: COMMENT; Schema: public; Owner: manga
627--
628
629COMMENT ON TABLE series_tags IS 'Identifies tags associated with a series.';
630
631
632--
633-- Name: COLUMN series_tags.series_id; Type: COMMENT; Schema: public; Owner: manga
634--
635
636COMMENT 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.';
637
638
639--
640-- Name: COLUMN series_tags.tag_name; Type: COMMENT; Schema: public; Owner: manga
641--
642
643COMMENT ON COLUMN series_tags.tag_name IS 'Identifies the tag associated with the series.\n\nHas foreign key relationship with the table of tags.';
644
645
646--
647-- Name: COLUMN series_tags.tag_namespace; Type: COMMENT; Schema: public; Owner: manga
648--
649
650COMMENT 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.';
651
652
653--
654-- Name: statuses; Type: TABLE; Schema: public; Owner: manga
655--
656
657CREATE TABLE statuses (
658 name text NOT NULL
659);
660
661
662ALTER TABLE statuses OWNER TO manga;
663
664--
665-- Name: TABLE statuses; Type: COMMENT; Schema: public; Owner: manga
666--
667
668COMMENT ON TABLE statuses IS 'Describes acceptable statuses for series.';
669
670
671--
672-- Name: COLUMN statuses.name; Type: COMMENT; Schema: public; Owner: manga
673--
674
675COMMENT ON COLUMN statuses.name IS 'Contains the name of the status, e.g. "Complete".';
676
677
678--
679-- Name: tags; Type: TABLE; Schema: public; Owner: manga
680--
681
682CREATE TABLE tags (
683 name text NOT NULL,
684 namespace text NOT NULL
685);
686
687
688ALTER TABLE tags OWNER TO manga;
689
690--
691-- Name: TABLE tags; Type: COMMENT; Schema: public; Owner: manga
692--
693
694COMMENT ON TABLE tags IS 'Describes the acceptable tags for series.';
695
696
697--
698-- Name: COLUMN tags.name; Type: COMMENT; Schema: public; Owner: manga
699--
700
701COMMENT ON COLUMN tags.name IS 'Describes the name of the tag.';
702
703
704--
705-- Name: COLUMN tags.namespace; Type: COMMENT; Schema: public; Owner: manga
706--
707
708COMMENT ON COLUMN tags.namespace IS 'Describes the namespace of the tag.';
709
710
711--
712-- Name: types; Type: TABLE; Schema: public; Owner: manga
713--
714
715CREATE TABLE types (
716 name text NOT NULL,
717 origin_demonym text NOT NULL
718);
719
720
721ALTER TABLE types OWNER TO manga;
722
723--
724-- Name: TABLE types; Type: COMMENT; Schema: public; Owner: manga
725--
726
727COMMENT 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.';
728
729
730--
731-- Name: COLUMN types.name; Type: COMMENT; Schema: public; Owner: manga
732--
733
734COMMENT ON COLUMN types.name IS 'Describes the name of the type of series, e.g. "Manga" or "Manhwa".';
735
736
737--
738-- Name: COLUMN types.origin_demonym; Type: COMMENT; Schema: public; Owner: manga
739--
740
741COMMENT ON COLUMN types.origin_demonym IS 'Describes the demonym for the country of origin for this series type, e.g. "Japanese" or "Korean".';
742
743
744--
745-- Name: users; Type: TABLE; Schema: public; Owner: manga
746--
747
748CREATE TABLE users (
749 id bigint NOT NULL,
750 username text NOT NULL,
751 email text,
752 password_hash bytea NOT NULL
753);
754
755
756ALTER TABLE users OWNER TO manga;
757
758--
759-- Name: TABLE users; Type: COMMENT; Schema: public; Owner: manga
760--
761
762COMMENT ON TABLE users IS 'Describes user accounts for the Batoto replacement site.';
763
764
765--
766-- Name: COLUMN users.id; Type: COMMENT; Schema: public; Owner: manga
767--
768
769COMMENT 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.';
770
771
772--
773-- Name: COLUMN users.username; Type: COMMENT; Schema: public; Owner: manga
774--
775
776COMMENT ON COLUMN users.username IS 'Username used as a login credential for the user, as well as a human readable account identifier.';
777
778
779--
780-- Name: COLUMN users.email; Type: COMMENT; Schema: public; Owner: manga
781--
782
783COMMENT ON COLUMN users.email IS 'Email address associated with a user account.';
784
785
786--
787-- Name: COLUMN users.password_hash; Type: COMMENT; Schema: public; Owner: manga
788--
789
790COMMENT 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.';
791
792
793--
794-- Name: users_following_series; Type: TABLE; Schema: public; Owner: manga
795--
796
797CREATE TABLE users_following_series (
798 user_id bigint NOT NULL,
799 series_id bigint NOT NULL
800);
801
802
803ALTER TABLE users_following_series OWNER TO manga;
804
805--
806-- Name: TABLE users_following_series; Type: COMMENT; Schema: public; Owner: manga
807--
808
809COMMENT ON TABLE users_following_series IS 'Describes the series that a user is following.';
810
811
812--
813-- Name: COLUMN users_following_series.user_id; Type: COMMENT; Schema: public; Owner: manga
814--
815
816COMMENT ON COLUMN users_following_series.user_id IS 'Identifies the user that is following a series.';
817
818
819--
820-- Name: COLUMN users_following_series.series_id; Type: COMMENT; Schema: public; Owner: manga
821--
822
823COMMENT ON COLUMN users_following_series.series_id IS 'Identifies the series that the user is following.';
824
825
826--
827-- Name: users_groups; Type: TABLE; Schema: public; Owner: manga
828--
829
830CREATE TABLE users_groups (
831 user_id bigint NOT NULL,
832 group_name text NOT NULL
833);
834
835
836ALTER TABLE users_groups OWNER TO manga;
837
838--
839-- Name: TABLE users_groups; Type: COMMENT; Schema: public; Owner: manga
840--
841
842COMMENT ON TABLE users_groups IS 'Identifies scanlation groups that a user belongs to.';
843
844
845--
846-- Name: COLUMN users_groups.user_id; Type: COMMENT; Schema: public; Owner: manga
847--
848
849COMMENT ON COLUMN users_groups.user_id IS 'Identifies the user that belongs to a given group.';
850
851
852--
853-- Name: COLUMN users_groups.group_name; Type: COMMENT; Schema: public; Owner: manga
854--
855
856COMMENT ON COLUMN users_groups.group_name IS 'Identifies the scanlation group that the user belongs to.';
857
858
859--
860-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: manga
861--
862
863CREATE SEQUENCE users_id_seq
864 START WITH 1
865 INCREMENT BY 1
866 NO MINVALUE
867 NO MAXVALUE
868 CACHE 1;
869
870
871ALTER TABLE users_id_seq OWNER TO manga;
872
873--
874-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: manga
875--
876
877ALTER SEQUENCE users_id_seq OWNED BY users.id;
878
879
880--
881-- Name: series id; Type: DEFAULT; Schema: public; Owner: manga
882--
883
884ALTER TABLE ONLY series ALTER COLUMN id SET DEFAULT nextval('series_id_seq'::regclass);
885
886
887--
888-- Name: series_chapters id; Type: DEFAULT; Schema: public; Owner: manga
889--
890
891ALTER TABLE ONLY series_chapters ALTER COLUMN id SET DEFAULT nextval('series_chapters_id_seq'::regclass);
892
893
894--
895-- Name: users id; Type: DEFAULT; Schema: public; Owner: manga
896--
897
898ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
899
900
901--
902-- Name: series_chapters idx_series_chapters_hash; Type: CONSTRAINT; Schema: public; Owner: manga
903--
904
905ALTER TABLE ONLY series_chapters
906 ADD CONSTRAINT idx_series_chapters_hash UNIQUE (hash);
907
908
909--
910-- Name: CONSTRAINT idx_series_chapters_hash ON series_chapters; Type: COMMENT; Schema: public; Owner: manga
911--
912
913COMMENT 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.';
914
915
916--
917-- Name: series idx_series_name; Type: CONSTRAINT; Schema: public; Owner: manga
918--
919
920ALTER TABLE ONLY series
921 ADD CONSTRAINT idx_series_name UNIQUE (name);
922
923
924--
925-- Name: CONSTRAINT idx_series_name ON series; Type: COMMENT; Schema: public; Owner: manga
926--
927
928COMMENT ON CONSTRAINT idx_series_name ON series IS 'Index indexing the name of the series.';
929
930
931--
932-- Name: groups_scanlation pk_groups_scanlation_name; Type: CONSTRAINT; Schema: public; Owner: manga
933--
934
935ALTER TABLE ONLY groups_scanlation
936 ADD CONSTRAINT pk_groups_scanlation_name PRIMARY KEY (name);
937
938
939--
940-- Name: groups_scanlation_urls pk_groups_scanlation_urls; Type: CONSTRAINT; Schema: public; Owner: manga
941--
942
943ALTER TABLE ONLY groups_scanlation_urls
944 ADD CONSTRAINT pk_groups_scanlation_urls PRIMARY KEY (group_name, url);
945
946
947--
948-- Name: CONSTRAINT pk_groups_scanlation_urls ON groups_scanlation_urls; Type: COMMENT; Schema: public; Owner: manga
949--
950
951COMMENT 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.';
952
953
954--
955-- Name: languages pk_languages_name; Type: CONSTRAINT; Schema: public; Owner: manga
956--
957
958ALTER TABLE ONLY languages
959 ADD CONSTRAINT pk_languages_name PRIMARY KEY (name);
960
961
962--
963-- Name: CONSTRAINT pk_languages_name ON languages; Type: COMMENT; Schema: public; Owner: manga
964--
965
966COMMENT ON CONSTRAINT pk_languages_name ON languages IS 'Primary key encapsulating the name of the language.';
967
968
969--
970-- Name: series_aliases pk_series_aliases; Type: CONSTRAINT; Schema: public; Owner: manga
971--
972
973ALTER TABLE ONLY series_aliases
974 ADD CONSTRAINT pk_series_aliases PRIMARY KEY (series_id, name);
975
976
977--
978-- Name: CONSTRAINT pk_series_aliases ON series_aliases; Type: COMMENT; Schema: public; Owner: manga
979--
980
981COMMENT 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.';
982
983
984--
985-- Name: series_chapters_files pk_series_chapters_file; Type: CONSTRAINT; Schema: public; Owner: manga
986--
987
988ALTER TABLE ONLY series_chapters_files
989 ADD CONSTRAINT pk_series_chapters_file PRIMARY KEY (chapter_id, name);
990
991
992--
993-- Name: CONSTRAINT pk_series_chapters_file ON series_chapters_files; Type: COMMENT; Schema: public; Owner: manga
994--
995
996COMMENT 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.';
997
998
999--
1000-- Name: series_chapters_groups pk_series_chapters_groups; Type: CONSTRAINT; Schema: public; Owner: manga
1001--
1002
1003ALTER TABLE ONLY series_chapters_groups
1004 ADD CONSTRAINT pk_series_chapters_groups PRIMARY KEY (chapter_id, group_name);
1005
1006
1007--
1008-- Name: CONSTRAINT pk_series_chapters_groups ON series_chapters_groups; Type: COMMENT; Schema: public; Owner: manga
1009--
1010
1011COMMENT 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.';
1012
1013
1014--
1015-- Name: series_chapters pk_series_chapters_id; Type: CONSTRAINT; Schema: public; Owner: manga
1016--
1017
1018ALTER TABLE ONLY series_chapters
1019 ADD CONSTRAINT pk_series_chapters_id PRIMARY KEY (id);
1020
1021
1022--
1023-- Name: CONSTRAINT pk_series_chapters_id ON series_chapters; Type: COMMENT; Schema: public; Owner: manga
1024--
1025
1026COMMENT ON CONSTRAINT pk_series_chapters_id ON series_chapters IS 'Primary key encapsulating the unique identifier for the chapter.';
1027
1028
1029--
1030-- Name: series pk_series_id; Type: CONSTRAINT; Schema: public; Owner: manga
1031--
1032
1033ALTER TABLE ONLY series
1034 ADD CONSTRAINT pk_series_id PRIMARY KEY (id);
1035
1036
1037--
1038-- Name: CONSTRAINT pk_series_id ON series; Type: COMMENT; Schema: public; Owner: manga
1039--
1040
1041COMMENT ON CONSTRAINT pk_series_id ON series IS 'Primary key encapsulating the automatically generated unique identifier for the series.';
1042
1043
1044--
1045-- Name: series_ratings pk_series_ratings; Type: CONSTRAINT; Schema: public; Owner: manga
1046--
1047
1048ALTER TABLE ONLY series_ratings
1049 ADD CONSTRAINT pk_series_ratings PRIMARY KEY (series_id, user_id);
1050
1051
1052--
1053-- Name: CONSTRAINT pk_series_ratings ON series_ratings; Type: COMMENT; Schema: public; Owner: manga
1054--
1055
1056COMMENT 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.';
1057
1058
1059--
1060-- Name: series_tags pk_series_tags; Type: CONSTRAINT; Schema: public; Owner: manga
1061--
1062
1063ALTER TABLE ONLY series_tags
1064 ADD CONSTRAINT pk_series_tags PRIMARY KEY (series_id, tag_name, tag_namespace);
1065
1066
1067--
1068-- Name: CONSTRAINT pk_series_tags ON series_tags; Type: COMMENT; Schema: public; Owner: manga
1069--
1070
1071COMMENT 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.';
1072
1073
1074--
1075-- Name: statuses pk_statuses_name; Type: CONSTRAINT; Schema: public; Owner: manga
1076--
1077
1078ALTER TABLE ONLY statuses
1079 ADD CONSTRAINT pk_statuses_name PRIMARY KEY (name);
1080
1081
1082--
1083-- Name: CONSTRAINT pk_statuses_name ON statuses; Type: COMMENT; Schema: public; Owner: manga
1084--
1085
1086COMMENT ON CONSTRAINT pk_statuses_name ON statuses IS 'Primary key encapsulating the name of the series status.';
1087
1088
1089--
1090-- Name: tags pk_tags_name_namespace; Type: CONSTRAINT; Schema: public; Owner: manga
1091--
1092
1093ALTER TABLE ONLY tags
1094 ADD CONSTRAINT pk_tags_name_namespace PRIMARY KEY (name, namespace);
1095
1096
1097--
1098-- Name: CONSTRAINT pk_tags_name_namespace ON tags; Type: COMMENT; Schema: public; Owner: manga
1099--
1100
1101COMMENT ON CONSTRAINT pk_tags_name_namespace ON tags IS 'Primary key encapsulating the name and namespace of the tag.';
1102
1103
1104--
1105-- Name: types pk_types; Type: CONSTRAINT; Schema: public; Owner: manga
1106--
1107
1108ALTER TABLE ONLY types
1109 ADD CONSTRAINT pk_types PRIMARY KEY (name, origin_demonym);
1110
1111
1112--
1113-- Name: CONSTRAINT pk_types ON types; Type: COMMENT; Schema: public; Owner: manga
1114--
1115
1116COMMENT ON CONSTRAINT pk_types ON types IS 'Primary key encapsulating both the name of the series type, and the country of origin.';
1117
1118
1119--
1120-- Name: users_following_series pk_users_following_series; Type: CONSTRAINT; Schema: public; Owner: manga
1121--
1122
1123ALTER TABLE ONLY users_following_series
1124 ADD CONSTRAINT pk_users_following_series PRIMARY KEY (user_id, series_id);
1125
1126
1127--
1128-- Name: CONSTRAINT pk_users_following_series ON users_following_series; Type: COMMENT; Schema: public; Owner: manga
1129--
1130
1131COMMENT 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.';
1132
1133
1134--
1135-- Name: users_groups pk_users_groups; Type: CONSTRAINT; Schema: public; Owner: manga
1136--
1137
1138ALTER TABLE ONLY users_groups
1139 ADD CONSTRAINT pk_users_groups PRIMARY KEY (user_id, group_name);
1140
1141
1142--
1143-- Name: CONSTRAINT pk_users_groups ON users_groups; Type: COMMENT; Schema: public; Owner: manga
1144--
1145
1146COMMENT 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.';
1147
1148
1149--
1150-- Name: users pk_users_id; Type: CONSTRAINT; Schema: public; Owner: manga
1151--
1152
1153ALTER TABLE ONLY users
1154 ADD CONSTRAINT pk_users_id PRIMARY KEY (id);
1155
1156
1157--
1158-- Name: users pk_users_username; Type: CONSTRAINT; Schema: public; Owner: manga
1159--
1160
1161ALTER TABLE ONLY users
1162 ADD CONSTRAINT pk_users_username UNIQUE (username);
1163
1164
1165--
1166-- Name: CONSTRAINT pk_users_username ON users; Type: COMMENT; Schema: public; Owner: manga
1167--
1168
1169COMMENT 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.';
1170
1171
1172--
1173-- Name: idx_groups_scanlation_description; Type: INDEX; Schema: public; Owner: manga
1174--
1175
1176CREATE INDEX idx_groups_scanlation_description ON groups_scanlation USING btree (description);
1177
1178
1179--
1180-- Name: INDEX idx_groups_scanlation_description; Type: COMMENT; Schema: public; Owner: manga
1181--
1182
1183COMMENT ON INDEX idx_groups_scanlation_description IS 'Indexes the description of a scanlation group.Justification is to make scanlation groups searchabe by their description.';
1184
1185
1186--
1187-- Name: idx_groups_scanlation_links_group_name; Type: INDEX; Schema: public; Owner: manga
1188--
1189
1190CREATE INDEX idx_groups_scanlation_links_group_name ON groups_scanlation_urls USING btree (group_name);
1191
1192
1193--
1194-- Name: idx_groups_scanlation_release_delay; Type: INDEX; Schema: public; Owner: manga
1195--
1196
1197CREATE INDEX idx_groups_scanlation_release_delay ON groups_scanlation USING btree (release_delay);
1198
1199
1200--
1201-- Name: INDEX idx_groups_scanlation_release_delay; Type: COMMENT; Schema: public; Owner: manga
1202--
1203
1204COMMENT 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.';
1205
1206
1207--
1208-- Name: idx_series_aliases_series_id; Type: INDEX; Schema: public; Owner: manga
1209--
1210
1211CREATE INDEX idx_series_aliases_series_id ON series_aliases USING btree (series_id);
1212
1213
1214--
1215-- Name: INDEX idx_series_aliases_series_id; Type: COMMENT; Schema: public; Owner: manga
1216--
1217
1218COMMENT 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.';
1219
1220
1221--
1222-- Name: idx_series_chapters_chapter_language; Type: INDEX; Schema: public; Owner: manga
1223--
1224
1225CREATE INDEX idx_series_chapters_chapter_language ON series_chapters USING btree (chapter_language);
1226
1227
1228--
1229-- Name: idx_series_chapters_chapter_number_absolute; Type: INDEX; Schema: public; Owner: manga
1230--
1231
1232CREATE INDEX idx_series_chapters_chapter_number_absolute ON series_chapters USING btree (chapter_number_absolute);
1233
1234
1235--
1236-- Name: INDEX idx_series_chapters_chapter_number_absolute; Type: COMMENT; Schema: public; Owner: manga
1237--
1238
1239COMMENT ON INDEX idx_series_chapters_chapter_number_absolute IS 'Indexes the absolute chapter number of a series.Justification is to sort by chapter numbers.';
1240
1241
1242--
1243-- Name: idx_series_chapters_chapter_number_volume; Type: INDEX; Schema: public; Owner: manga
1244--
1245
1246CREATE INDEX idx_series_chapters_chapter_number_volume ON series_chapters USING btree (chapter_number_volume);
1247
1248
1249--
1250-- Name: INDEX idx_series_chapters_chapter_number_volume; Type: COMMENT; Schema: public; Owner: manga
1251--
1252
1253COMMENT 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.';
1254
1255
1256--
1257-- Name: idx_series_chapters_contributor_id; Type: INDEX; Schema: public; Owner: manga
1258--
1259
1260CREATE INDEX idx_series_chapters_contributor_id ON series_chapters USING btree (contributor_id);
1261
1262
1263--
1264-- Name: INDEX idx_series_chapters_contributor_id; Type: COMMENT; Schema: public; Owner: manga
1265--
1266
1267COMMENT 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.';
1268
1269
1270--
1271-- Name: idx_series_chapters_files_chapter_id; Type: INDEX; Schema: public; Owner: manga
1272--
1273
1274CREATE INDEX idx_series_chapters_files_chapter_id ON series_chapters_files USING btree (chapter_id);
1275
1276
1277--
1278-- Name: idx_series_chapters_groups_chapter_id; Type: INDEX; Schema: public; Owner: manga
1279--
1280
1281CREATE INDEX idx_series_chapters_groups_chapter_id ON series_chapters_groups USING btree (chapter_id);
1282
1283
1284--
1285-- Name: idx_series_chapters_groups_group_name; Type: INDEX; Schema: public; Owner: manga
1286--
1287
1288CREATE INDEX idx_series_chapters_groups_group_name ON series_chapters_groups USING btree (group_name);
1289
1290
1291--
1292-- Name: idx_series_chapters_series_id; Type: INDEX; Schema: public; Owner: manga
1293--
1294
1295CREATE INDEX idx_series_chapters_series_id ON series_chapters USING btree (series_id);
1296
1297
1298--
1299-- Name: idx_series_chapters_time_uploaded; Type: INDEX; Schema: public; Owner: manga
1300--
1301
1302CREATE INDEX idx_series_chapters_time_uploaded ON series_chapters USING btree (time_uploaded);
1303
1304
1305--
1306-- Name: INDEX idx_series_chapters_time_uploaded; Type: COMMENT; Schema: public; Owner: manga
1307--
1308
1309COMMENT ON INDEX idx_series_chapters_time_uploaded IS 'Indexes the time a chapter was uploaded.Justification is to search by upload time/date.';
1310
1311
1312--
1313-- Name: idx_series_chapters_title; Type: INDEX; Schema: public; Owner: manga
1314--
1315
1316CREATE INDEX idx_series_chapters_title ON series_chapters USING btree (title);
1317
1318
1319--
1320-- Name: INDEX idx_series_chapters_title; Type: COMMENT; Schema: public; Owner: manga
1321--
1322
1323COMMENT 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.';
1324
1325
1326--
1327-- Name: idx_series_chapters_volume_number; Type: INDEX; Schema: public; Owner: manga
1328--
1329
1330CREATE INDEX idx_series_chapters_volume_number ON series_chapters USING btree (volume_number);
1331
1332
1333--
1334-- Name: INDEX idx_series_chapters_volume_number; Type: COMMENT; Schema: public; Owner: manga
1335--
1336
1337COMMENT ON INDEX idx_series_chapters_volume_number IS 'Indexes the volume number of a series.Justification is to sort by volume numbers.';
1338
1339
1340--
1341-- Name: idx_series_description; Type: INDEX; Schema: public; Owner: manga
1342--
1343
1344CREATE INDEX idx_series_description ON series USING btree (description);
1345
1346
1347--
1348-- Name: INDEX idx_series_description; Type: COMMENT; Schema: public; Owner: manga
1349--
1350
1351COMMENT ON INDEX idx_series_description IS 'Index indexing the description of the series.';
1352
1353
1354--
1355-- Name: idx_series_ratings_series_id; Type: INDEX; Schema: public; Owner: manga
1356--
1357
1358CREATE INDEX idx_series_ratings_series_id ON series_ratings USING btree (series_id);
1359
1360
1361--
1362-- Name: INDEX idx_series_ratings_series_id; Type: COMMENT; Schema: public; Owner: manga
1363--
1364
1365COMMENT 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.';
1366
1367
1368--
1369-- Name: idx_series_ratings_user_id; Type: INDEX; Schema: public; Owner: manga
1370--
1371
1372CREATE INDEX idx_series_ratings_user_id ON series_ratings USING btree (user_id);
1373
1374
1375--
1376-- Name: INDEX idx_series_ratings_user_id; Type: COMMENT; Schema: public; Owner: manga
1377--
1378
1379COMMENT 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.';
1380
1381
1382--
1383-- Name: idx_series_series_type_name; Type: INDEX; Schema: public; Owner: manga
1384--
1385
1386CREATE INDEX idx_series_series_type_name ON series USING btree (type_name);
1387
1388
1389--
1390-- Name: INDEX idx_series_series_type_name; Type: COMMENT; Schema: public; Owner: manga
1391--
1392
1393COMMENT ON INDEX idx_series_series_type_name IS 'Index indexing the name of the series type.';
1394
1395
1396--
1397-- Name: idx_series_status; Type: INDEX; Schema: public; Owner: manga
1398--
1399
1400CREATE INDEX idx_series_status ON series USING btree (status);
1401
1402
1403--
1404-- Name: INDEX idx_series_status; Type: COMMENT; Schema: public; Owner: manga
1405--
1406
1407COMMENT ON INDEX idx_series_status IS 'Index indexing the series status.';
1408
1409
1410--
1411-- Name: idx_series_tags_series_id; Type: INDEX; Schema: public; Owner: manga
1412--
1413
1414CREATE INDEX idx_series_tags_series_id ON series_tags USING btree (series_id);
1415
1416
1417--
1418-- Name: INDEX idx_series_tags_series_id; Type: COMMENT; Schema: public; Owner: manga
1419--
1420
1421COMMENT 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.';
1422
1423
1424--
1425-- Name: idx_series_tags_tag_name; Type: INDEX; Schema: public; Owner: manga
1426--
1427
1428CREATE INDEX idx_series_tags_tag_name ON series_tags USING btree (tag_name);
1429
1430
1431--
1432-- Name: INDEX idx_series_tags_tag_name; Type: COMMENT; Schema: public; Owner: manga
1433--
1434
1435COMMENT 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.';
1436
1437
1438--
1439-- Name: idx_series_tags_tag_name_namespace; Type: INDEX; Schema: public; Owner: manga
1440--
1441
1442CREATE INDEX idx_series_tags_tag_name_namespace ON series_tags USING btree (tag_name, tag_namespace);
1443
1444
1445--
1446-- Name: INDEX idx_series_tags_tag_name_namespace; Type: COMMENT; Schema: public; Owner: manga
1447--
1448
1449COMMENT 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.';
1450
1451
1452--
1453-- Name: idx_series_tags_tag_namespace; Type: INDEX; Schema: public; Owner: manga
1454--
1455
1456CREATE INDEX idx_series_tags_tag_namespace ON series_tags USING btree (tag_namespace);
1457
1458
1459--
1460-- Name: INDEX idx_series_tags_tag_namespace; Type: COMMENT; Schema: public; Owner: manga
1461--
1462
1463COMMENT 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.';
1464
1465
1466--
1467-- Name: idx_series_type_demonym; Type: INDEX; Schema: public; Owner: manga
1468--
1469
1470CREATE INDEX idx_series_type_demonym ON series USING btree (type_demonym);
1471
1472
1473--
1474-- Name: INDEX idx_series_type_demonym; Type: COMMENT; Schema: public; Owner: manga
1475--
1476
1477COMMENT ON INDEX idx_series_type_demonym IS 'Index indexing the demonym of the series type.';
1478
1479
1480--
1481-- Name: idx_users_following_series_series_id; Type: INDEX; Schema: public; Owner: manga
1482--
1483
1484CREATE INDEX idx_users_following_series_series_id ON users_following_series USING btree (series_id);
1485
1486
1487--
1488-- Name: idx_users_following_series_user_id; Type: INDEX; Schema: public; Owner: manga
1489--
1490
1491CREATE INDEX idx_users_following_series_user_id ON users_following_series USING btree (user_id);
1492
1493
1494--
1495-- Name: idx_users_groups_group_name; Type: INDEX; Schema: public; Owner: manga
1496--
1497
1498CREATE INDEX idx_users_groups_group_name ON users_groups USING btree (group_name);
1499
1500
1501--
1502-- Name: idx_users_groups_user_id; Type: INDEX; Schema: public; Owner: manga
1503--
1504
1505CREATE INDEX idx_users_groups_user_id ON users_groups USING btree (user_id);
1506
1507
1508--
1509-- Name: groups_scanlation_urls fk_groups_scanlation_links; Type: FK CONSTRAINT; Schema: public; Owner: manga
1510--
1511
1512ALTER TABLE ONLY groups_scanlation_urls
1513 ADD CONSTRAINT fk_groups_scanlation_links FOREIGN KEY (group_name) REFERENCES groups_scanlation(name) ON UPDATE CASCADE ON DELETE CASCADE;
1514
1515
1516--
1517-- Name: CONSTRAINT fk_groups_scanlation_links ON groups_scanlation_urls; Type: COMMENT; Schema: public; Owner: manga
1518--
1519
1520COMMENT 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.';
1521
1522
1523--
1524-- Name: series_aliases fk_series_aliases_series; Type: FK CONSTRAINT; Schema: public; Owner: manga
1525--
1526
1527ALTER TABLE ONLY series_aliases
1528 ADD CONSTRAINT fk_series_aliases_series FOREIGN KEY (series_id) REFERENCES series(id) ON UPDATE CASCADE ON DELETE CASCADE;
1529
1530
1531--
1532-- Name: CONSTRAINT fk_series_aliases_series ON series_aliases; Type: COMMENT; Schema: public; Owner: manga
1533--
1534
1535COMMENT ON CONSTRAINT fk_series_aliases_series ON series_aliases IS 'Foreign key relationship binding the series alias to a particular series identifier.';
1536
1537
1538--
1539-- Name: series_chapters_files fk_series_chapters_files; Type: FK CONSTRAINT; Schema: public; Owner: manga
1540--
1541
1542ALTER TABLE ONLY series_chapters_files
1543 ADD CONSTRAINT fk_series_chapters_files FOREIGN KEY (chapter_id) REFERENCES series_chapters(id) ON UPDATE CASCADE ON DELETE CASCADE;
1544
1545
1546--
1547-- Name: CONSTRAINT fk_series_chapters_files ON series_chapters_files; Type: COMMENT; Schema: public; Owner: manga
1548--
1549
1550COMMENT 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.';
1551
1552
1553--
1554-- Name: series_chapters_groups fk_series_chapters_groups_chapter_id; Type: FK CONSTRAINT; Schema: public; Owner: manga
1555--
1556
1557ALTER TABLE ONLY series_chapters_groups
1558 ADD CONSTRAINT fk_series_chapters_groups_chapter_id FOREIGN KEY (chapter_id) REFERENCES series_chapters(id) ON UPDATE CASCADE ON DELETE CASCADE;
1559
1560
1561--
1562-- Name: CONSTRAINT fk_series_chapters_groups_chapter_id ON series_chapters_groups; Type: COMMENT; Schema: public; Owner: manga
1563--
1564
1565COMMENT 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.';
1566
1567
1568--
1569-- Name: series_chapters_groups fk_series_chapters_groups_group_name; Type: FK CONSTRAINT; Schema: public; Owner: manga
1570--
1571
1572ALTER TABLE ONLY series_chapters_groups
1573 ADD CONSTRAINT fk_series_chapters_groups_group_name FOREIGN KEY (group_name) REFERENCES groups_scanlation(name) ON UPDATE CASCADE;
1574
1575
1576--
1577-- Name: CONSTRAINT fk_series_chapters_groups_group_name ON series_chapters_groups; Type: COMMENT; Schema: public; Owner: manga
1578--
1579
1580COMMENT 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.';
1581
1582
1583--
1584-- Name: series_chapters fk_series_chapters_languages; Type: FK CONSTRAINT; Schema: public; Owner: manga
1585--
1586
1587ALTER TABLE ONLY series_chapters
1588 ADD CONSTRAINT fk_series_chapters_languages FOREIGN KEY (chapter_language) REFERENCES languages(name) ON UPDATE CASCADE;
1589
1590
1591--
1592-- Name: CONSTRAINT fk_series_chapters_languages ON series_chapters; Type: COMMENT; Schema: public; Owner: manga
1593--
1594
1595COMMENT ON CONSTRAINT fk_series_chapters_languages ON series_chapters IS 'Foreign key relationship binding the language of the series chapter to the languages table.';
1596
1597
1598--
1599-- Name: series_chapters fk_series_chapters_series_id; Type: FK CONSTRAINT; Schema: public; Owner: manga
1600--
1601
1602ALTER TABLE ONLY series_chapters
1603 ADD CONSTRAINT fk_series_chapters_series_id FOREIGN KEY (series_id) REFERENCES series(id) ON UPDATE CASCADE ON DELETE CASCADE;
1604
1605
1606--
1607-- Name: CONSTRAINT fk_series_chapters_series_id ON series_chapters; Type: COMMENT; Schema: public; Owner: manga
1608--
1609
1610COMMENT 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.';
1611
1612
1613--
1614-- Name: series_chapters fk_series_chapters_users; Type: FK CONSTRAINT; Schema: public; Owner: manga
1615--
1616
1617ALTER TABLE ONLY series_chapters
1618 ADD CONSTRAINT fk_series_chapters_users FOREIGN KEY (contributor_id) REFERENCES users(id) ON UPDATE CASCADE;
1619
1620
1621--
1622-- Name: CONSTRAINT fk_series_chapters_users ON series_chapters; Type: COMMENT; Schema: public; Owner: manga
1623--
1624
1625COMMENT 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.';
1626
1627
1628--
1629-- Name: series_ratings fk_series_ratings_series; Type: FK CONSTRAINT; Schema: public; Owner: manga
1630--
1631
1632ALTER TABLE ONLY series_ratings
1633 ADD CONSTRAINT fk_series_ratings_series FOREIGN KEY (series_id) REFERENCES series(id) ON UPDATE CASCADE ON DELETE CASCADE;
1634
1635
1636--
1637-- Name: CONSTRAINT fk_series_ratings_series ON series_ratings; Type: COMMENT; Schema: public; Owner: manga
1638--
1639
1640COMMENT 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.';
1641
1642
1643--
1644-- Name: series_ratings fk_series_ratings_users; Type: FK CONSTRAINT; Schema: public; Owner: manga
1645--
1646
1647ALTER TABLE ONLY series_ratings
1648 ADD CONSTRAINT fk_series_ratings_users FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE;
1649
1650
1651--
1652-- Name: CONSTRAINT fk_series_ratings_users ON series_ratings; Type: COMMENT; Schema: public; Owner: manga
1653--
1654
1655COMMENT 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.';
1656
1657
1658--
1659-- Name: series fk_series_statuses; Type: FK CONSTRAINT; Schema: public; Owner: manga
1660--
1661
1662ALTER TABLE ONLY series
1663 ADD CONSTRAINT fk_series_statuses FOREIGN KEY (status) REFERENCES statuses(name) ON UPDATE CASCADE;
1664
1665
1666--
1667-- Name: CONSTRAINT fk_series_statuses ON series; Type: COMMENT; Schema: public; Owner: manga
1668--
1669
1670COMMENT ON CONSTRAINT fk_series_statuses ON series IS 'Foreign key relationship binding series status to the table of allowable series statuses.';
1671
1672
1673--
1674-- Name: series_tags fk_series_tags_series; Type: FK CONSTRAINT; Schema: public; Owner: manga
1675--
1676
1677ALTER TABLE ONLY series_tags
1678 ADD CONSTRAINT fk_series_tags_series FOREIGN KEY (series_id) REFERENCES series(id) ON UPDATE CASCADE ON DELETE CASCADE;
1679
1680
1681--
1682-- Name: CONSTRAINT fk_series_tags_series ON series_tags; Type: COMMENT; Schema: public; Owner: manga
1683--
1684
1685COMMENT 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.';
1686
1687
1688--
1689-- Name: series_tags fk_series_tags_tags; Type: FK CONSTRAINT; Schema: public; Owner: manga
1690--
1691
1692ALTER TABLE ONLY series_tags
1693 ADD CONSTRAINT fk_series_tags_tags FOREIGN KEY (tag_namespace) REFERENCES tags(namespace) ON UPDATE CASCADE ON DELETE CASCADE;
1694
1695
1696--
1697-- Name: CONSTRAINT fk_series_tags_tags ON series_tags; Type: COMMENT; Schema: public; Owner: manga
1698--
1699
1700COMMENT 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.';
1701
1702
1703--
1704-- Name: series_tags fk_series_tags_tags_name; Type: FK CONSTRAINT; Schema: public; Owner: manga
1705--
1706
1707ALTER TABLE ONLY series_tags
1708 ADD CONSTRAINT fk_series_tags_tags_name FOREIGN KEY (tag_name) REFERENCES tags(name) ON UPDATE CASCADE ON DELETE CASCADE;
1709
1710
1711--
1712-- Name: CONSTRAINT fk_series_tags_tags_name ON series_tags; Type: COMMENT; Schema: public; Owner: manga
1713--
1714
1715COMMENT 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.';
1716
1717
1718--
1719-- Name: users_following_series fk_users_following_series_series_id; Type: FK CONSTRAINT; Schema: public; Owner: manga
1720--
1721
1722ALTER TABLE ONLY users_following_series
1723 ADD CONSTRAINT fk_users_following_series_series_id FOREIGN KEY (series_id) REFERENCES series(id) ON UPDATE CASCADE ON DELETE CASCADE;
1724
1725
1726--
1727-- Name: CONSTRAINT fk_users_following_series_series_id ON users_following_series; Type: COMMENT; Schema: public; Owner: manga
1728--
1729
1730COMMENT 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.';
1731
1732
1733--
1734-- Name: users_following_series fk_users_following_series_user_id; Type: FK CONSTRAINT; Schema: public; Owner: manga
1735--
1736
1737ALTER TABLE ONLY users_following_series
1738 ADD CONSTRAINT fk_users_following_series_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE;
1739
1740
1741--
1742-- Name: CONSTRAINT fk_users_following_series_user_id ON users_following_series; Type: COMMENT; Schema: public; Owner: manga
1743--
1744
1745COMMENT 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.';
1746
1747
1748--
1749-- Name: users_groups fk_users_groups_group_name; Type: FK CONSTRAINT; Schema: public; Owner: manga
1750--
1751
1752ALTER TABLE ONLY users_groups
1753 ADD CONSTRAINT fk_users_groups_group_name FOREIGN KEY (group_name) REFERENCES groups_scanlation(name) ON UPDATE CASCADE ON DELETE CASCADE;
1754
1755
1756--
1757-- Name: CONSTRAINT fk_users_groups_group_name ON users_groups; Type: COMMENT; Schema: public; Owner: manga
1758--
1759
1760COMMENT 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.';
1761
1762
1763--
1764-- Name: users_groups fk_users_groups_users; Type: FK CONSTRAINT; Schema: public; Owner: manga
1765--
1766
1767ALTER TABLE ONLY users_groups
1768 ADD CONSTRAINT fk_users_groups_users FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE;
1769
1770
1771--
1772-- Name: CONSTRAINT fk_users_groups_users ON users_groups; Type: COMMENT; Schema: public; Owner: manga
1773--
1774
1775COMMENT ON CONSTRAINT fk_users_groups_users ON users_groups IS 'Foreign key binding the user identifier to an actual entry in the users table.';
1776
1777
1778--
1779-- PostgreSQL database dump complete
1780--