-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathinit.sql
1552 lines (1036 loc) · 41.5 KB
/
init.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
CREATE DATABASE velog
LC_COLLATE 'C'
LC_CTYPE 'C'
ENCODING 'UTF8'
TEMPLATE template0;
CREATE USER velog WITH ENCRYPTED PASSWORD 'velogpw';
GRANT ALL PRIVILEGES ON DATABASE velog to velog;
\c velog
--
-- PostgreSQL database dump
--
-- Dumped from database version 11.5
-- Dumped by pg_dump version 11.5
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
--
-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
--
-- Name: admin_users; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.admin_users (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_user_id uuid NOT NULL,
created_at timestamp without time zone DEFAULT now() NOT NULL,
updated_at timestamp without time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.admin_users OWNER TO velog;
--
-- Name: auth_tokens; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.auth_tokens (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_user_id uuid NOT NULL,
created_at timestamp without time zone DEFAULT now() NOT NULL,
updated_at timestamp without time zone DEFAULT now() NOT NULL,
disabled boolean DEFAULT false NOT NULL
);
ALTER TABLE public.auth_tokens OWNER TO velog;
--
-- Name: categories; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.categories (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
name character varying(255),
url_slug character varying(255),
"order" integer,
parent character varying(255),
fk_user_id uuid,
private boolean DEFAULT false,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.categories OWNER TO velog;
--
-- Name: comments; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.comments (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_post_id uuid,
fk_user_id uuid,
text text,
likes integer DEFAULT 0,
meta_json text,
reply_to uuid,
level integer DEFAULT 0,
has_replies boolean DEFAULT false,
deleted boolean DEFAULT false,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.comments OWNER TO velog;
--
-- Name: email_auth; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.email_auth (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
code character varying(255),
email character varying(255),
logged boolean DEFAULT false,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.email_auth OWNER TO velog;
--
-- Name: email_cert; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.email_cert (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
code character varying(255),
fk_user_id uuid,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
status boolean DEFAULT true
);
ALTER TABLE public.email_cert OWNER TO velog;
--
-- Name: feeds; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.feeds (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_post_id uuid,
fk_user_id uuid,
reason jsonb,
score integer DEFAULT 1,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.feeds OWNER TO velog;
--
-- Name: follow_tag; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.follow_tag (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_user_id uuid,
fk_tag_id uuid,
score integer,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.follow_tag OWNER TO velog;
--
-- Name: follow_user; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.follow_user (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_user_id uuid,
fk_follow_user_id uuid,
score integer,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.follow_user OWNER TO velog;
--
-- Name: migrations; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.migrations (
id integer NOT NULL,
"timestamp" bigint NOT NULL,
name character varying NOT NULL
);
ALTER TABLE public.migrations OWNER TO velog;
--
-- Name: migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: velog
--
CREATE SEQUENCE public.migrations_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.migrations_id_seq OWNER TO velog;
--
-- Name: migrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: velog
--
ALTER SEQUENCE public.migrations_id_seq OWNED BY public.migrations.id;
--
-- Name: post_histories; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.post_histories (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_post_id uuid,
title character varying(255),
body text,
is_release boolean DEFAULT false NOT NULL,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
is_markdown boolean DEFAULT false NOT NULL
);
ALTER TABLE public.post_histories OWNER TO velog;
--
-- Name: post_images; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.post_images (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_post_id uuid,
fk_user_id uuid,
path character varying(255),
filesize integer,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.post_images OWNER TO velog;
--
-- Name: post_likes; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.post_likes (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_post_id uuid,
fk_user_id uuid,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.post_likes OWNER TO velog;
--
-- Name: post_reads; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.post_reads (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
ip_hash character varying(255),
fk_user_id uuid,
fk_post_id uuid,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.post_reads OWNER TO velog;
--
-- Name: post_scores; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.post_scores (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
type character varying(255),
fk_user_id uuid,
fk_post_id uuid,
score double precision DEFAULT 0,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.post_scores OWNER TO velog;
--
-- Name: post_tags; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.post_tags (
fk_post_id uuid NOT NULL,
fk_tag_id uuid NOT NULL
);
ALTER TABLE public.post_tags OWNER TO velog;
--
-- Name: posts; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.posts (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
title character varying(255),
body text,
short_description character varying(255),
thumbnail character varying(255),
is_markdown boolean,
is_temp boolean,
fk_user_id uuid,
original_post_id uuid,
url_slug character varying(255),
likes integer DEFAULT 0,
meta jsonb DEFAULT '{}'::jsonb,
views integer DEFAULT 0,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
is_private boolean DEFAULT false NOT NULL,
released_at timestamp with time zone DEFAULT now(),
tsv tsvector
);
ALTER TABLE public.posts OWNER TO velog;
--
-- Name: posts_categories; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.posts_categories (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_post_id uuid,
fk_category_id uuid,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.posts_categories OWNER TO velog;
--
-- Name: posts_tags; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.posts_tags (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_post_id uuid,
fk_tag_id uuid,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.posts_tags OWNER TO velog;
--
-- Name: series; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.series (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_user_id uuid,
name character varying(255),
description text,
thumbnail character varying(255),
url_slug character varying(255),
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.series OWNER TO velog;
--
-- Name: series_posts; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.series_posts (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_series_id uuid,
fk_post_id uuid,
index integer,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.series_posts OWNER TO velog;
--
-- Name: social_accounts; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.social_accounts (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
social_id character varying(255),
access_token character varying(255),
provider character varying(255),
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
fk_user_id uuid
);
ALTER TABLE public.social_accounts OWNER TO velog;
--
-- Name: tag_alias; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.tag_alias (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_tag_id uuid NOT NULL,
fk_alias_tag_id uuid NOT NULL,
created_at timestamp without time zone DEFAULT now() NOT NULL,
updated_at timestamp without time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.tag_alias OWNER TO velog;
--
-- Name: tags; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.tags (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
name character varying(255),
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
description character varying(255),
thumbnail character varying(255),
name_filtered character varying(255),
is_alias boolean DEFAULT false NOT NULL
);
ALTER TABLE public.tags OWNER TO velog;
--
-- Name: url_slug_histories; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.url_slug_histories (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_post_id uuid,
fk_user_id uuid,
url_slug character varying(255),
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.url_slug_histories OWNER TO velog;
--
-- Name: user_images; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.user_images (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_user_id uuid,
path character varying(255),
filesize integer,
type character varying(255),
ref_id uuid,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.user_images OWNER TO velog;
--
-- Name: user_meta; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.user_meta (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_user_id uuid,
email_notification boolean DEFAULT false,
email_promotion boolean DEFAULT false,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.user_meta OWNER TO velog;
--
-- Name: user_profiles; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.user_profiles (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
display_name character varying(255),
short_bio character varying(255),
thumbnail character varying(255),
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
fk_user_id uuid,
profile_links jsonb DEFAULT '{}'::jsonb NOT NULL,
about text DEFAULT ''::text NOT NULL
);
ALTER TABLE public.user_profiles OWNER TO velog;
--
-- Name: user_thumbnails; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.user_thumbnails (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
fk_user_id uuid,
path character varying(255),
filesize integer,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
ALTER TABLE public.user_thumbnails OWNER TO velog;
--
-- Name: users; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.users (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
username character varying(255),
email character varying(255),
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
is_certified boolean DEFAULT false
);
ALTER TABLE public.users OWNER TO velog;
--
-- Name: velog_configs; Type: TABLE; Schema: public; Owner: velog
--
CREATE TABLE public.velog_configs (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
created_at timestamp without time zone DEFAULT now() NOT NULL,
updated_at timestamp without time zone DEFAULT now() NOT NULL,
title character varying(255),
logo_image character varying(255),
fk_user_id uuid NOT NULL
);
ALTER TABLE public.velog_configs OWNER TO velog;
--
-- Name: migrations id; Type: DEFAULT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.migrations ALTER COLUMN id SET DEFAULT nextval('public.migrations_id_seq'::regclass);
--
-- Name: admin_users PK_06744d221bb6145dc61e5dc441d; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.admin_users
ADD CONSTRAINT "PK_06744d221bb6145dc61e5dc441d" PRIMARY KEY (id);
--
-- Name: post_tags PK_0734929674029206aa2b8b4554a; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.post_tags
ADD CONSTRAINT "PK_0734929674029206aa2b8b4554a" PRIMARY KEY (fk_post_id, fk_tag_id);
--
-- Name: velog_configs PK_24f36353fb78d23293b7a3f15df; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.velog_configs
ADD CONSTRAINT "PK_24f36353fb78d23293b7a3f15df" PRIMARY KEY (id);
--
-- Name: auth_tokens PK_41e9ddfbb32da18c4e85e45c2fd; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.auth_tokens
ADD CONSTRAINT "PK_41e9ddfbb32da18c4e85e45c2fd" PRIMARY KEY (id);
--
-- Name: migrations PK_8c82d7f526340ab734260ea46be; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.migrations
ADD CONSTRAINT "PK_8c82d7f526340ab734260ea46be" PRIMARY KEY (id);
--
-- Name: tag_alias PK_8eddc983e5df66c0c2644e33152; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.tag_alias
ADD CONSTRAINT "PK_8eddc983e5df66c0c2644e33152" PRIMARY KEY (id);
--
-- Name: velog_configs REL_8b5be783e08f563452ec0c489e; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.velog_configs
ADD CONSTRAINT "REL_8b5be783e08f563452ec0c489e" UNIQUE (fk_user_id);
--
-- Name: categories categories_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.categories
ADD CONSTRAINT categories_pkey PRIMARY KEY (id);
--
-- Name: comments comments_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.comments
ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
--
-- Name: email_auth email_auth_code_key; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.email_auth
ADD CONSTRAINT email_auth_code_key UNIQUE (code);
--
-- Name: email_auth email_auth_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.email_auth
ADD CONSTRAINT email_auth_pkey PRIMARY KEY (id);
--
-- Name: email_cert email_cert_code_key; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.email_cert
ADD CONSTRAINT email_cert_code_key UNIQUE (code);
--
-- Name: email_cert email_cert_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.email_cert
ADD CONSTRAINT email_cert_pkey PRIMARY KEY (id);
--
-- Name: feeds feeds_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.feeds
ADD CONSTRAINT feeds_pkey PRIMARY KEY (id);
--
-- Name: follow_tag follow_tag_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.follow_tag
ADD CONSTRAINT follow_tag_pkey PRIMARY KEY (id);
--
-- Name: follow_user follow_user_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.follow_user
ADD CONSTRAINT follow_user_pkey PRIMARY KEY (id);
--
-- Name: post_histories post_histories_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.post_histories
ADD CONSTRAINT post_histories_pkey PRIMARY KEY (id);
--
-- Name: post_images post_images_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.post_images
ADD CONSTRAINT post_images_pkey PRIMARY KEY (id);
--
-- Name: post_likes post_likes_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.post_likes
ADD CONSTRAINT post_likes_pkey PRIMARY KEY (id);
--
-- Name: post_reads post_reads_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.post_reads
ADD CONSTRAINT post_reads_pkey PRIMARY KEY (id);
--
-- Name: post_scores post_scores_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.post_scores
ADD CONSTRAINT post_scores_pkey PRIMARY KEY (id);
--
-- Name: posts_categories posts_categories_fk_post_id_fk_category_id_key; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.posts_categories
ADD CONSTRAINT posts_categories_fk_post_id_fk_category_id_key UNIQUE (fk_post_id, fk_category_id);
--
-- Name: posts_categories posts_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.posts_categories
ADD CONSTRAINT posts_categories_pkey PRIMARY KEY (id);
--
-- Name: posts posts_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.posts
ADD CONSTRAINT posts_pkey PRIMARY KEY (id);
--
-- Name: posts_tags posts_tags_fk_post_id_fk_tag_id_key; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.posts_tags
ADD CONSTRAINT posts_tags_fk_post_id_fk_tag_id_key UNIQUE (fk_post_id, fk_tag_id);
--
-- Name: posts_tags posts_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.posts_tags
ADD CONSTRAINT posts_tags_pkey PRIMARY KEY (id);
--
-- Name: series series_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.series
ADD CONSTRAINT series_pkey PRIMARY KEY (id);
--
-- Name: series_posts series_posts_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.series_posts
ADD CONSTRAINT series_posts_pkey PRIMARY KEY (id);
--
-- Name: social_accounts social_accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.social_accounts
ADD CONSTRAINT social_accounts_pkey PRIMARY KEY (id);
--
-- Name: tags tags_name_key; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.tags
ADD CONSTRAINT tags_name_key UNIQUE (name);
--
-- Name: tags tags_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.tags
ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
--
-- Name: url_slug_histories url_slug_histories_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.url_slug_histories
ADD CONSTRAINT url_slug_histories_pkey PRIMARY KEY (id);
--
-- Name: user_images user_images_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.user_images
ADD CONSTRAINT user_images_pkey PRIMARY KEY (id);
--
-- Name: user_meta user_meta_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.user_meta
ADD CONSTRAINT user_meta_pkey PRIMARY KEY (id);
--
-- Name: user_profiles user_profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.user_profiles
ADD CONSTRAINT user_profiles_pkey PRIMARY KEY (id);
--
-- Name: user_thumbnails user_thumbnails_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.user_thumbnails
ADD CONSTRAINT user_thumbnails_pkey PRIMARY KEY (id);
--
-- Name: users users_email_key; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_email_key UNIQUE (email);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: users users_username_key; Type: CONSTRAINT; Schema: public; Owner: velog
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_username_key UNIQUE (username);
--
-- Name: IDX_38921256eca6f24170411db8ac; Type: INDEX; Schema: public; Owner: velog
--
CREATE INDEX "IDX_38921256eca6f24170411db8ac" ON public.tag_alias USING btree (fk_tag_id);
--
-- Name: IDX_3d4d13db047f2b2ca7671b8403; Type: INDEX; Schema: public; Owner: velog
--
CREATE INDEX "IDX_3d4d13db047f2b2ca7671b8403" ON public.post_tags USING btree (fk_post_id);
--
-- Name: IDX_4de7a827965a085c53d7983f48; Type: INDEX; Schema: public; Owner: velog
--
CREATE INDEX "IDX_4de7a827965a085c53d7983f48" ON public.post_tags USING btree (fk_tag_id);
--
-- Name: IDX_548ae43e47192962c941abbc4d; Type: INDEX; Schema: public; Owner: velog
--
CREATE INDEX "IDX_548ae43e47192962c941abbc4d" ON public.admin_users USING btree (fk_user_id);
--
-- Name: IDX_7b79c9ec6899a16e12374462df; Type: INDEX; Schema: public; Owner: velog
--
CREATE INDEX "IDX_7b79c9ec6899a16e12374462df" ON public.tag_alias USING btree (fk_alias_tag_id);
--
-- Name: categories_url_slug; Type: INDEX; Schema: public; Owner: velog
--
CREATE INDEX categories_url_slug ON public.categories USING btree (url_slug);
--
-- Name: category_order_of_user; Type: INDEX; Schema: public; Owner: velog
--
CREATE INDEX category_order_of_user ON public.categories USING btree (fk_user_id, parent, "order");
--
-- Name: comments_created_at; Type: INDEX; Schema: public; Owner: velog
--
CREATE INDEX comments_created_at ON public.comments USING btree (created_at);
--
-- Name: email_cert_fk_user_id; Type: INDEX; Schema: public; Owner: velog
--
CREATE INDEX email_cert_fk_user_id ON public.email_cert USING btree (fk_user_id);
--
-- Name: feeds_created_at; Type: INDEX; Schema: public; Owner: velog
--
CREATE INDEX feeds_created_at ON public.feeds USING btree (created_at);
--
-- Name: post_histories_created_at; Type: INDEX; Schema: public; Owner: velog
--
CREATE INDEX post_histories_created_at ON public.post_histories USING btree (created_at);
--
-- Name: post_histories_fk_post_id; Type: INDEX; Schema: public; Owner: velog
--
CREATE INDEX post_histories_fk_post_id ON public.post_histories USING btree (fk_post_id);
--
-- Name: post_likes_fk_post_id_fk_user_id; Type: INDEX; Schema: public; Owner: velog
--
CREATE UNIQUE INDEX post_likes_fk_post_id_fk_user_id ON public.post_likes USING btree (fk_post_id, fk_user_id);
CREATE INDEX post_likes_created_at ON public.post_likes USING btree (created_at);
CREATE INDEX post_likes_fk_user_id ON public.post_likes USING btree (fk_user_id);
--
-- Name: post_reads_created_at; Type: INDEX; Schema: public; Owner: velog
--
CREATE INDEX post_reads_created_at ON public.post_reads USING btree (created_at);