-- JSON in PostgreSQL, examples by Jonas Duregård

DROP TABLE IF EXISTS Posts;
DROP TABLE IF EXISTS Users;

CREATE TABLE Users( uname TEXT PRIMARY KEY, email TEXT UNIQUE );

CREATE TABLE Posts(
  id SERIAL PRIMARY KEY, 
  author TEXT NOT NULL REFERENCES Users(uname),
  created TIMESTAMP NOT NULL,
  content JSONB NOT NULL
);
