-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.sql
546 lines (356 loc) · 13.3 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
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.6 (Ubuntu 15.6-1.pgdg20.04+1)
-- Dumped by pg_dump version 15.6 (Ubuntu 15.6-1.pgdg22.04+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;
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: heroku_ext; Type: SCHEMA; Schema: -; Owner: u7b7f96790uiq3
--
CREATE SCHEMA heroku_ext;
ALTER SCHEMA heroku_ext OWNER TO u7b7f96790uiq3;
--
-- Name: public; Type: SCHEMA; Schema: -; Owner: kyohoodnwmtyrb
--
-- *not* creating schema, since initdb creates it
ALTER SCHEMA public OWNER TO kyohoodnwmtyrb;
--
-- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS pg_stat_statements WITH SCHEMA heroku_ext;
--
-- Name: EXTENSION pg_stat_statements; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION pg_stat_statements IS 'track planning and execution statistics of all SQL statements executed';
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE TABLE public.active_storage_attachments (
id bigint NOT NULL,
name character varying NOT NULL,
record_type character varying NOT NULL,
record_id bigint NOT NULL,
blob_id bigint NOT NULL,
created_at timestamp without time zone NOT NULL
);
ALTER TABLE public.active_storage_attachments OWNER TO kyohoodnwmtyrb;
--
-- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE SEQUENCE public.active_storage_attachments_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.active_storage_attachments_id_seq OWNER TO kyohoodnwmtyrb;
--
-- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
--
-- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE TABLE public.active_storage_blobs (
id bigint NOT NULL,
key character varying NOT NULL,
filename character varying NOT NULL,
content_type character varying,
metadata text,
byte_size bigint NOT NULL,
checksum character varying NOT NULL,
created_at timestamp without time zone NOT NULL
);
ALTER TABLE public.active_storage_blobs OWNER TO kyohoodnwmtyrb;
--
-- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE SEQUENCE public.active_storage_blobs_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.active_storage_blobs_id_seq OWNER TO kyohoodnwmtyrb;
--
-- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
--
-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE TABLE public.ar_internal_metadata (
key character varying NOT NULL,
value character varying,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
ALTER TABLE public.ar_internal_metadata OWNER TO kyohoodnwmtyrb;
--
-- Name: comments; Type: TABLE; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE TABLE public.comments (
id bigint NOT NULL,
content text,
user_id bigint NOT NULL,
post_id bigint NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
ALTER TABLE public.comments OWNER TO kyohoodnwmtyrb;
--
-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE SEQUENCE public.comments_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.comments_id_seq OWNER TO kyohoodnwmtyrb;
--
-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER SEQUENCE public.comments_id_seq OWNED BY public.comments.id;
--
-- Name: likes; Type: TABLE; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE TABLE public.likes (
id bigint NOT NULL,
post_id bigint NOT NULL,
user_id bigint NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
ALTER TABLE public.likes OWNER TO kyohoodnwmtyrb;
--
-- Name: likes_id_seq; Type: SEQUENCE; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE SEQUENCE public.likes_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.likes_id_seq OWNER TO kyohoodnwmtyrb;
--
-- Name: likes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER SEQUENCE public.likes_id_seq OWNED BY public.likes.id;
--
-- Name: posts; Type: TABLE; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE TABLE public.posts (
id bigint NOT NULL,
title character varying,
description text,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
user_id bigint,
slug character varying,
image_url character varying
);
ALTER TABLE public.posts OWNER TO kyohoodnwmtyrb;
--
-- Name: posts_id_seq; Type: SEQUENCE; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE SEQUENCE public.posts_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.posts_id_seq OWNER TO kyohoodnwmtyrb;
--
-- Name: posts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER SEQUENCE public.posts_id_seq OWNED BY public.posts.id;
--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE TABLE public.schema_migrations (
version character varying NOT NULL
);
ALTER TABLE public.schema_migrations OWNER TO kyohoodnwmtyrb;
--
-- Name: users; Type: TABLE; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE TABLE public.users (
id bigint NOT NULL,
name character varying,
email character varying,
password_digest character varying,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
ALTER TABLE public.users OWNER TO kyohoodnwmtyrb;
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE SEQUENCE public.users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.users_id_seq OWNER TO kyohoodnwmtyrb;
--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
--
-- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
--
-- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
--
-- Name: comments id; Type: DEFAULT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.comments ALTER COLUMN id SET DEFAULT nextval('public.comments_id_seq'::regclass);
--
-- Name: likes id; Type: DEFAULT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.likes ALTER COLUMN id SET DEFAULT nextval('public.likes_id_seq'::regclass);
--
-- Name: posts id; Type: DEFAULT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.posts ALTER COLUMN id SET DEFAULT nextval('public.posts_id_seq'::regclass);
--
-- Name: users id; Type: DEFAULT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
--
-- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.active_storage_attachments
ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
--
-- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.active_storage_blobs
ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
--
-- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.ar_internal_metadata
ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
--
-- Name: comments comments_pkey; Type: CONSTRAINT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.comments
ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
--
-- Name: likes likes_pkey; Type: CONSTRAINT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.likes
ADD CONSTRAINT likes_pkey PRIMARY KEY (id);
--
-- Name: posts posts_pkey; Type: CONSTRAINT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.posts
ADD CONSTRAINT posts_pkey PRIMARY KEY (id);
--
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.schema_migrations
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
--
-- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
--
-- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
--
-- Name: index_comments_on_post_id; Type: INDEX; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE INDEX index_comments_on_post_id ON public.comments USING btree (post_id);
--
-- Name: index_comments_on_user_id; Type: INDEX; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE INDEX index_comments_on_user_id ON public.comments USING btree (user_id);
--
-- Name: index_likes_on_post_id; Type: INDEX; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE INDEX index_likes_on_post_id ON public.likes USING btree (post_id);
--
-- Name: index_likes_on_user_id; Type: INDEX; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE INDEX index_likes_on_user_id ON public.likes USING btree (user_id);
--
-- Name: index_posts_on_slug; Type: INDEX; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE UNIQUE INDEX index_posts_on_slug ON public.posts USING btree (slug);
--
-- Name: index_posts_on_user_id; Type: INDEX; Schema: public; Owner: kyohoodnwmtyrb
--
CREATE INDEX index_posts_on_user_id ON public.posts USING btree (user_id);
--
-- Name: comments fk_rails_03de2dc08c; Type: FK CONSTRAINT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.comments
ADD CONSTRAINT fk_rails_03de2dc08c FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: likes fk_rails_1e09b5dabf; Type: FK CONSTRAINT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.likes
ADD CONSTRAINT fk_rails_1e09b5dabf FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: comments fk_rails_2fd19c0db7; Type: FK CONSTRAINT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.comments
ADD CONSTRAINT fk_rails_2fd19c0db7 FOREIGN KEY (post_id) REFERENCES public.posts(id);
--
-- Name: posts fk_rails_5b5ddfd518; Type: FK CONSTRAINT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.posts
ADD CONSTRAINT fk_rails_5b5ddfd518 FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: likes fk_rails_87a8aac469; Type: FK CONSTRAINT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.likes
ADD CONSTRAINT fk_rails_87a8aac469 FOREIGN KEY (post_id) REFERENCES public.posts(id);
--
-- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: kyohoodnwmtyrb
--
ALTER TABLE ONLY public.active_storage_attachments
ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
--
-- Name: SCHEMA heroku_ext; Type: ACL; Schema: -; Owner: u7b7f96790uiq3
--
GRANT USAGE ON SCHEMA heroku_ext TO kyohoodnwmtyrb;
--
-- Name: LANGUAGE plpgsql; Type: ACL; Schema: -; Owner: postgres
--
GRANT ALL ON LANGUAGE plpgsql TO kyohoodnwmtyrb;
--
-- Name: FUNCTION pg_stat_statements_reset(userid oid, dbid oid, queryid bigint); Type: ACL; Schema: heroku_ext; Owner: u7b7f96790uiq3
--
GRANT ALL ON FUNCTION heroku_ext.pg_stat_statements_reset(userid oid, dbid oid, queryid bigint) TO kyohoodnwmtyrb;
--
-- PostgreSQL database dump complete
--