@@ -5,28 +5,42 @@ example of a table that could be created after setup complete
5
5
6
6
- uncomment the statements below
7
7
- save the file and graphile-migrate will update the schema into database automagically
8
+ - any "drop" statements should be at the top (in reverse order)
8
9
*/
9
10
10
- -- CREATE TYPE app_public.post_topic AS enum (
11
+ -- drop table if exists feed;
12
+ -- drop table if exists post;
13
+
14
+ -- create type app_public.post_topic as enum (
11
15
-- 'discussion',
12
16
-- 'inspiration',
13
17
-- 'help',
14
18
-- 'showcase'
15
19
-- );
16
20
17
- -- CREATE TABLE IF NOT EXISTS app_public.post (
18
- -- id SERIAL PRIMARY KEY ,
19
- -- author_id INTEGER NOT NULL REFERENCES app_public.users(id),
20
- -- headline TEXT NOT NULL CHECK (char_length(headline) < 280),
21
- -- body TEXT ,
21
+ -- create table if not exists app_public.post (
22
+ -- id serial primary key ,
23
+ -- author_id integer not null references app_public.users(id),
24
+ -- headline text not null check (char_length(headline) < 280),
25
+ -- body text ,
22
26
-- topic app_public.post_topic,
23
- -- created_at TIMESTAMP default NOW()
27
+ -- created_at timestamp default now()
28
+ -- );
29
+
30
+ -- comment on table app_public.post is 'a forum post written by a user.';
31
+ -- comment on column app_public.post.id is 'the primary key for the post.';
32
+ -- comment on column app_public.post.headline is 'the title written by the user.';
33
+ -- comment on column app_public.post.author_id is 'the id of the author user.';
34
+ -- comment on column app_public.post.topic is 'the topic this has been posted in.';
35
+ -- comment on column app_public.post.body is 'the main body text of our post.';
36
+ -- comment on column app_public.post.created_at is 'the time this post was created.';
37
+
38
+ -- create table if not exists app_public.feed (
39
+ -- id serial primary key,
40
+ -- posts integer not null references app_public.post(id),
41
+ -- created_at timestamp default now()
24
42
-- );
25
43
26
- -- COMMENT ON TABLE APP_PUBLIC.POST IS 'A forum post written by a user.';
27
- -- COMMENT ON COLUMN APP_PUBLIC.POST.ID IS 'The primary key for the post.';
28
- -- COMMENT ON COLUMN APP_PUBLIC.POST.HEADLINE IS 'The title written by the user.';
29
- -- COMMENT ON COLUMN APP_PUBLIC.POST.AUTHOR_ID IS 'The id of the author user.';
30
- -- COMMENT ON COLUMN APP_PUBLIC.POST.TOPIC IS 'The topic this has been posted in.';
31
- -- COMMENT ON COLUMN APP_PUBLIC.POST.BODY IS 'The main body text of our post.';
32
- -- COMMENT ON COLUMN APP_PUBLIC.POST.CREATED_AT IS 'The time this post was created.';
44
+ -- comment on table app_public.feed is 'the feed of the posts';
45
+ -- comment on column app_public.feed.id is 'the primary key for the feed.';
46
+ -- comment on column app_public.feed.created_at is 'the time this feed was created.';
0 commit comments