-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathschema.sql
1691 lines (1034 loc) · 47.5 KB
/
schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--
-- PostgreSQL database dump
--
-- Dumped from database version 10.1
-- Dumped by pg_dump version 10.1
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: batoto; Type: SCHEMA; Schema: -; Owner: manga
--
CREATE SCHEMA batoto;
ALTER SCHEMA batoto OWNER TO manga;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
--
-- Name: language; Type: TYPE; Schema: public; Owner: postgres
--
CREATE TYPE language AS ENUM (
'English',
'Spanish',
'French',
'German',
'Portuguese',
'Turkish',
'Indonesian',
'Greek',
'Filipino',
'Italian',
'Polish',
'Thai',
'Malay',
'Hungarian',
'Romanian',
'Arabic',
'Hebrew',
'Russian',
'Vietnamese',
'Dutch',
'Bengali',
'Persian',
'Czech',
'Brazilian',
'Bulgarian',
'Danish',
'Esperanto',
'Swedish',
'Lithuanian',
'Other'
);
ALTER TYPE language OWNER TO postgres;
--
-- Name: status; Type: TYPE; Schema: public; Owner: postgres
--
CREATE TYPE status AS ENUM (
'Stalled',
'Discontinued',
'Ongoing',
'Complete'
);
ALTER TYPE status OWNER TO postgres;
--
-- Name: type; Type: TYPE; Schema: public; Owner: postgres
--
CREATE TYPE type AS ENUM (
'Manga (Japanese)',
'Manhwa (Korean)',
'Webcomic (Japanese)',
'Webcomic (Korean)'
);
ALTER TYPE type OWNER TO postgres;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: groups_scanlation; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE groups_scanlation (
name text NOT NULL,
description text NOT NULL,
release_delay integer
);
ALTER TABLE groups_scanlation OWNER TO manga;
--
-- Name: TABLE groups_scanlation; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON TABLE groups_scanlation IS 'Describes scanlation groups; groups who scan and translate series.';
--
-- Name: COLUMN groups_scanlation.name; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN groups_scanlation.name IS 'Name to refer to the scanlation group by.';
--
-- Name: COLUMN groups_scanlation.description; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN groups_scanlation.description IS 'Human readable description for the scanlation group.';
--
-- Name: COLUMN groups_scanlation.release_delay; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN groups_scanlation.release_delay IS 'A fixed delay, counted from the time a chapter is uploaded, before the chapter should be released.';
--
-- Name: groups_scanlation_urls; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE groups_scanlation_urls (
group_name text NOT NULL,
url text NOT NULL
);
ALTER TABLE groups_scanlation_urls OWNER TO manga;
--
-- Name: TABLE groups_scanlation_urls; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON TABLE groups_scanlation_urls IS 'URLs belonging to a scanlation group. Might be scanlation group websites, social media pages, etc.';
--
-- Name: COLUMN groups_scanlation_urls.group_name; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: COLUMN groups_scanlation_urls.url; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN groups_scanlation_urls.url IS 'The actual URL associated with the scanlation group.';
--
-- Name: languages; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE languages (
name text NOT NULL,
code text
);
ALTER TABLE languages OWNER TO manga;
--
-- Name: TABLE languages; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON TABLE languages IS 'Describes acceptable languages for series chapters.';
--
-- Name: COLUMN languages.name; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN languages.name IS 'Contains the name of the language, e.g. "English".';
--
-- Name: series; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE series (
id bigint NOT NULL,
name text NOT NULL,
description text NOT NULL,
cover_image text NOT NULL,
type_name text NOT NULL,
type_demonym text NOT NULL,
status text NOT NULL
);
ALTER TABLE series OWNER TO manga;
--
-- Name: TABLE series; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON TABLE series IS 'Describes manga, manhwa, etc series.';
--
-- Name: COLUMN series.id; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series.id IS 'Unique automatically generated sequential identifier for the series.';
--
-- Name: COLUMN series.name; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series.name IS 'Preferred name to refer to a series by.';
--
-- Name: COLUMN series.description; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series.description IS 'Human readable description of the series.';
--
-- Name: COLUMN series.cover_image; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series.cover_image IS 'IPFS hash for the preferred cover image for the series.';
--
-- Name: COLUMN series.type_name; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: COLUMN series.type_demonym; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: COLUMN series.status; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: series_aliases; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE series_aliases (
series_id bigint NOT NULL,
name text NOT NULL
);
ALTER TABLE series_aliases OWNER TO manga;
--
-- Name: TABLE series_aliases; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON TABLE series_aliases IS 'Contains the alternative names for series.';
--
-- Name: COLUMN series_aliases.series_id; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: COLUMN series_aliases.name; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_aliases.name IS 'Alternative name to refer to the series by.';
--
-- Name: series_chapters; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE series_chapters (
id bigint NOT NULL,
series_id bigint NOT NULL,
title text NOT NULL,
chapter_number_absolute text NOT NULL,
chapter_number_volume numeric(10,2),
volume_number numeric(10,2),
chapter_language text NOT NULL,
contributor_id bigint,
time_uploaded timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
hash text NOT NULL
);
ALTER TABLE series_chapters OWNER TO manga;
--
-- Name: TABLE series_chapters; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON TABLE series_chapters IS 'Describes chapters of a series.';
--
-- Name: COLUMN series_chapters.id; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: COLUMN series_chapters.series_id; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_chapters.series_id IS 'Identifies the series the chapter belongs to.\n\nHas foreign key relationship with the series table.';
--
-- Name: COLUMN series_chapters.title; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_chapters.title IS 'Title of the chapter.';
--
-- Name: COLUMN series_chapters.chapter_number_absolute; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: COLUMN series_chapters.chapter_number_volume; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: COLUMN series_chapters.volume_number; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_chapters.volume_number IS 'The number of the volume the chapter belongs to.';
--
-- Name: COLUMN series_chapters.chapter_language; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_chapters.chapter_language IS 'Language of the text content of the chapter.\n\nHas foreign key relationship with the languages table.';
--
-- Name: COLUMN series_chapters.contributor_id; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_chapters.contributor_id IS 'Identifies the user who contributed the chapter.\n\nHas foreign key relationship with the table of users.';
--
-- Name: COLUMN series_chapters.time_uploaded; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_chapters.time_uploaded IS 'Timestamp of when the chapter was uploaded.\n\nDefaults to current time.';
--
-- Name: COLUMN series_chapters.hash; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_chapters.hash IS 'IPFS hash of the folder for the series chapter.';
--
-- Name: series_chapters_files; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE series_chapters_files (
chapter_id bigint NOT NULL,
name text NOT NULL
);
ALTER TABLE series_chapters_files OWNER TO manga;
--
-- Name: TABLE series_chapters_files; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: COLUMN series_chapters_files.chapter_id; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: COLUMN series_chapters_files.name; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_chapters_files.name IS 'Semantic name of the file in the chapter''s folder.';
--
-- Name: series_chapters_groups; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE series_chapters_groups (
chapter_id bigint NOT NULL,
group_name text NOT NULL
);
ALTER TABLE series_chapters_groups OWNER TO manga;
--
-- Name: TABLE series_chapters_groups; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON TABLE series_chapters_groups IS 'Identifies the scanlation groups a series chapter belongs to.';
--
-- Name: COLUMN series_chapters_groups.chapter_id; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_chapters_groups.chapter_id IS 'Identifies the chapter that belongs to a given scanlation group.';
--
-- Name: COLUMN series_chapters_groups.group_name; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_chapters_groups.group_name IS 'Identifies the name of the scanlation group that the chapter belongs to.';
--
-- Name: series_chapters_id_seq; Type: SEQUENCE; Schema: public; Owner: manga
--
CREATE SEQUENCE series_chapters_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE series_chapters_id_seq OWNER TO manga;
--
-- Name: series_chapters_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: manga
--
ALTER SEQUENCE series_chapters_id_seq OWNED BY series_chapters.id;
--
-- Name: series_id_seq; Type: SEQUENCE; Schema: public; Owner: manga
--
CREATE SEQUENCE series_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE series_id_seq OWNER TO manga;
--
-- Name: series_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: manga
--
ALTER SEQUENCE series_id_seq OWNED BY series.id;
--
-- Name: series_ratings; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE series_ratings (
series_id bigint NOT NULL,
user_id bigint NOT NULL,
rating integer NOT NULL
);
ALTER TABLE series_ratings OWNER TO manga;
--
-- Name: TABLE series_ratings; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON TABLE series_ratings IS 'Describes ratings of a series that users have made.';
--
-- Name: COLUMN series_ratings.series_id; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_ratings.series_id IS 'Identifies the series that is being rated.';
--
-- Name: COLUMN series_ratings.user_id; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_ratings.user_id IS 'Identifies the user that is rating the series.';
--
-- Name: COLUMN series_ratings.rating; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_ratings.rating IS 'The actual rating of the series, on a yet to be determined scale.';
--
-- Name: series_tags; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE series_tags (
series_id bigint NOT NULL,
tag_name text NOT NULL,
tag_namespace text NOT NULL
);
ALTER TABLE series_tags OWNER TO manga;
--
-- Name: TABLE series_tags; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON TABLE series_tags IS 'Identifies tags associated with a series.';
--
-- Name: COLUMN series_tags.series_id; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: COLUMN series_tags.tag_name; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN series_tags.tag_name IS 'Identifies the tag associated with the series.\n\nHas foreign key relationship with the table of tags.';
--
-- Name: COLUMN series_tags.tag_namespace; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: statuses; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE statuses (
name text NOT NULL
);
ALTER TABLE statuses OWNER TO manga;
--
-- Name: TABLE statuses; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON TABLE statuses IS 'Describes acceptable statuses for series.';
--
-- Name: COLUMN statuses.name; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN statuses.name IS 'Contains the name of the status, e.g. "Complete".';
--
-- Name: tags; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE tags (
name text NOT NULL,
namespace text NOT NULL
);
ALTER TABLE tags OWNER TO manga;
--
-- Name: TABLE tags; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON TABLE tags IS 'Describes the acceptable tags for series.';
--
-- Name: COLUMN tags.name; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN tags.name IS 'Describes the name of the tag.';
--
-- Name: COLUMN tags.namespace; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN tags.namespace IS 'Describes the namespace of the tag.';
--
-- Name: types; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE types (
name text NOT NULL,
origin_demonym text NOT NULL
);
ALTER TABLE types OWNER TO manga;
--
-- Name: TABLE types; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: COLUMN types.name; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN types.name IS 'Describes the name of the type of series, e.g. "Manga" or "Manhwa".';
--
-- Name: COLUMN types.origin_demonym; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN types.origin_demonym IS 'Describes the demonym for the country of origin for this series type, e.g. "Japanese" or "Korean".';
--
-- Name: users; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE users (
id bigint NOT NULL,
username text NOT NULL,
email text,
password_hash bytea NOT NULL
);
ALTER TABLE users OWNER TO manga;
--
-- Name: TABLE users; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON TABLE users IS 'Describes user accounts for the Batoto replacement site.';
--
-- Name: COLUMN users.id; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: COLUMN users.username; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN users.username IS 'Username used as a login credential for the user, as well as a human readable account identifier.';
--
-- Name: COLUMN users.email; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN users.email IS 'Email address associated with a user account.';
--
-- Name: COLUMN users.password_hash; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: users_following_series; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE users_following_series (
user_id bigint NOT NULL,
series_id bigint NOT NULL
);
ALTER TABLE users_following_series OWNER TO manga;
--
-- Name: TABLE users_following_series; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON TABLE users_following_series IS 'Describes the series that a user is following.';
--
-- Name: COLUMN users_following_series.user_id; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN users_following_series.user_id IS 'Identifies the user that is following a series.';
--
-- Name: COLUMN users_following_series.series_id; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN users_following_series.series_id IS 'Identifies the series that the user is following.';
--
-- Name: users_groups; Type: TABLE; Schema: public; Owner: manga
--
CREATE TABLE users_groups (
user_id bigint NOT NULL,
group_name text NOT NULL
);
ALTER TABLE users_groups OWNER TO manga;
--
-- Name: TABLE users_groups; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON TABLE users_groups IS 'Identifies scanlation groups that a user belongs to.';
--
-- Name: COLUMN users_groups.user_id; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN users_groups.user_id IS 'Identifies the user that belongs to a given group.';
--
-- Name: COLUMN users_groups.group_name; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON COLUMN users_groups.group_name IS 'Identifies the scanlation group that the user belongs to.';
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: manga
--
CREATE SEQUENCE users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE users_id_seq OWNER TO manga;
--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: manga
--
ALTER SEQUENCE users_id_seq OWNED BY users.id;
--
-- Name: series id; Type: DEFAULT; Schema: public; Owner: manga
--
ALTER TABLE ONLY series ALTER COLUMN id SET DEFAULT nextval('series_id_seq'::regclass);
--
-- Name: series_chapters id; Type: DEFAULT; Schema: public; Owner: manga
--
ALTER TABLE ONLY series_chapters ALTER COLUMN id SET DEFAULT nextval('series_chapters_id_seq'::regclass);
--
-- Name: users id; Type: DEFAULT; Schema: public; Owner: manga
--
ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
--
-- Name: series_chapters idx_series_chapters_hash; Type: CONSTRAINT; Schema: public; Owner: manga
--
ALTER TABLE ONLY series_chapters
ADD CONSTRAINT idx_series_chapters_hash UNIQUE (hash);
--
-- Name: CONSTRAINT idx_series_chapters_hash ON series_chapters; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: series idx_series_name; Type: CONSTRAINT; Schema: public; Owner: manga
--
ALTER TABLE ONLY series
ADD CONSTRAINT idx_series_name UNIQUE (name);
--
-- Name: CONSTRAINT idx_series_name ON series; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON CONSTRAINT idx_series_name ON series IS 'Index indexing the name of the series.';
--
-- Name: groups_scanlation pk_groups_scanlation_name; Type: CONSTRAINT; Schema: public; Owner: manga
--
ALTER TABLE ONLY groups_scanlation
ADD CONSTRAINT pk_groups_scanlation_name PRIMARY KEY (name);
--
-- Name: groups_scanlation_urls pk_groups_scanlation_urls; Type: CONSTRAINT; Schema: public; Owner: manga
--
ALTER TABLE ONLY groups_scanlation_urls
ADD CONSTRAINT pk_groups_scanlation_urls PRIMARY KEY (group_name, url);
--
-- Name: CONSTRAINT pk_groups_scanlation_urls ON groups_scanlation_urls; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: languages pk_languages_name; Type: CONSTRAINT; Schema: public; Owner: manga
--
ALTER TABLE ONLY languages
ADD CONSTRAINT pk_languages_name PRIMARY KEY (name);
--
-- Name: CONSTRAINT pk_languages_name ON languages; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON CONSTRAINT pk_languages_name ON languages IS 'Primary key encapsulating the name of the language.';
--
-- Name: series_aliases pk_series_aliases; Type: CONSTRAINT; Schema: public; Owner: manga
--
ALTER TABLE ONLY series_aliases
ADD CONSTRAINT pk_series_aliases PRIMARY KEY (series_id, name);
--
-- Name: CONSTRAINT pk_series_aliases ON series_aliases; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: series_chapters_files pk_series_chapters_file; Type: CONSTRAINT; Schema: public; Owner: manga
--
ALTER TABLE ONLY series_chapters_files
ADD CONSTRAINT pk_series_chapters_file PRIMARY KEY (chapter_id, name);
--
-- Name: CONSTRAINT pk_series_chapters_file ON series_chapters_files; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: series_chapters_groups pk_series_chapters_groups; Type: CONSTRAINT; Schema: public; Owner: manga
--
ALTER TABLE ONLY series_chapters_groups
ADD CONSTRAINT pk_series_chapters_groups PRIMARY KEY (chapter_id, group_name);
--
-- Name: CONSTRAINT pk_series_chapters_groups ON series_chapters_groups; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT 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.';
--
-- Name: series_chapters pk_series_chapters_id; Type: CONSTRAINT; Schema: public; Owner: manga
--
ALTER TABLE ONLY series_chapters
ADD CONSTRAINT pk_series_chapters_id PRIMARY KEY (id);
--
-- Name: CONSTRAINT pk_series_chapters_id ON series_chapters; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON CONSTRAINT pk_series_chapters_id ON series_chapters IS 'Primary key encapsulating the unique identifier for the chapter.';
--
-- Name: series pk_series_id; Type: CONSTRAINT; Schema: public; Owner: manga
--
ALTER TABLE ONLY series
ADD CONSTRAINT pk_series_id PRIMARY KEY (id);
--
-- Name: CONSTRAINT pk_series_id ON series; Type: COMMENT; Schema: public; Owner: manga
--
COMMENT ON CONSTRAINT pk_series_id ON series IS 'Primary key encapsulating the automatically generated unique identifier for the series.';
--
-- Name: series_ratings pk_series_ratings; Type: CONSTRAINT; Schema: public; Owner: manga
--