diff --git a/examples/forum/schema.sql b/examples/forum/schema.sql index 9e96048f11..22f110750d 100644 --- a/examples/forum/schema.sql +++ b/examples/forum/schema.sql @@ -3,19 +3,19 @@ begin; -- Create the schema we are going to use. -create schema if not exists forum_example; +create schema forum_example; -- By setting the `search_path`, whenever we create something in the default -- namespace it is actually created in the `blog_example` schema. -- -- For example, this lets us write `create table person …` instead of --- `create table blog_example.person …`. +-- `create table forum_example.person …`. set search_path = forum_example; ------------------------------------------------------------------------------- -- Basic Tables -create table if not exists person ( +create table person ( id serial not null primary key, given_name varchar(64) not null, family_name varchar(64), @@ -28,10 +28,13 @@ comment on column person.given_name is 'The person’s first name.'; comment on column person.family_name is 'The person’s last name.'; comment on column person.about is 'A short description about the user, written by the user.'; -create table if not exists post ( +create type post_topic as enum ('discussion', 'inspiration', 'help'); + +create table post ( id serial not null primary key, author_id int not null references person(id), headline text not null, + topic post_topic, body text ); @@ -58,31 +61,21 @@ insert into person (id, given_name, family_name, about) values (11, 'Beverly', 'Kelly', null), (12, 'Kelly', 'Reed', null), (13, 'Nicholas', 'Perry', null), - (14, 'Carol', 'Taylor', null) - on conflict (id) do - update set - given_name = excluded.given_name, - family_name = excluded.family_name, - about = excluded.about; + (14, 'Carol', 'Taylor', null); -insert into post (id, author_id, headline, body) values - (1, 2, 'No… It’s a thing; it’s like a plan, but with more greatness.', null), - (2, 1, 'I hate yogurt. It’s just stuff with bits in.', null), - (3, 1, 'Is that a cooking show?', null), - (4, 1, 'You hit me with a cricket bat.', null), - (5, 5, 'Please, Don-Bot… look into your hard drive, and open your mercy file!', null), - (6, 3, 'Stop talking, brain thinking. Hush.', null), - (7, 1, 'Large bet on myself in round one.', null), - (8, 2, 'It’s a fez. I wear a fez now. Fezes are cool.', null), - (9, 3, 'You know how I sometimes have really brilliant ideas?', null), - (10, 2, 'What’s with you kids? Every other day it’s food, food, food.', null), - (11, 3, 'They’re not aliens, they’re Earth…liens!', null), - (12, 5, 'You’ve swallowed a planet!', null) - on conflict (id) do - update set - author_id = excluded.author_id, - headline = excluded.headline, - body = excluded.body; +insert into post (id, author_id, headline, topic, body) values + (1, 2, 'No… It’s a thing; it’s like a plan, but with more greatness.', null, null), + (2, 1, 'I hate yogurt. It’s just stuff with bits in.', 'inspiration', null), + (3, 1, 'Is that a cooking show?', 'inspiration', null), + (4, 1, 'You hit me with a cricket bat.', null, null), + (5, 5, 'Please, Don-Bot… look into your hard drive, and open your mercy file!', null, null), + (6, 3, 'Stop talking, brain thinking. Hush.', null, null), + (7, 1, 'Large bet on myself in round one.', 'discussion', null), + (8, 2, 'It’s a fez. I wear a fez now. Fezes are cool.', 'inspiration', null), + (9, 3, 'You know how I sometimes have really brilliant ideas?', null, null), + (10, 2, 'What’s with you kids? Every other day it’s food, food, food.', 'discussion', null), + (11, 3, 'They’re not aliens, they’re Earth…liens!', 'help', null), + (12, 5, 'You’ve swallowed a planet!', null, null); ------------------------------------------------------------------------------- -- Permissions diff --git a/scripts/start.sh b/scripts/start.sh index 3ccdcc602d..fb22f7080d 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,6 +1,4 @@ #!/bin/bash -npm run schema-up - babel-watch --watch src \ src/main.js -- postgres://localhost:5432 --schema forum_example --development