Sha256: be0ec830f5b3089fcc740a31feab5613af310a28ff9e0548711e5e76f1294448

Contents?: true

Size: 1.36 KB

Versions: 26

Compression:

Stored size: 1.36 KB

Contents

\connect postgres

drop database if exists pg_graph;
create database pg_graph;

\connect pg_graph

create table roles (
  id integer generated by default as identity primary key,
  name text not null,
  active boolean not null default true
);

create table pictures (
  id integer generated by default as identity primary key,
  title text not null,
  blob text not null
);

create table users (
  id integer generated by default as identity primary key,
  name text not null,
  age integer,
  role_id integer not null references roles(id),
  picture_id integer unique references pictures(id)
);

create table blogs (
  id integer generated by default as identity primary key,
  user_id integer not null references users(id),
  title text not null
);

create table posts (
  id integer generated by default as identity primary key,
  blog_id integer not null references blogs(id),
  head text not null,
  body text not null,
  created_at timestamp without time zone default (now() at time zone 'UTC')
);

create table comments (
  id integer generated by default as identity primary key,
  post_id integer not null references posts(id),
  author_id integer not null references users(id),
  head text not null,
  body text not null,
  created_at timestamp without time zone default (now() at time zone 'UTC')
);

alter table users add column last_post_id integer unique references posts(id);

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
pg_graph-0.5.3 snippets/db.sql
pg_graph-0.5.2 snippets/db.sql
pg_graph-0.5.1 snippets/db.sql
pg_graph-0.5.0 snippets/db.sql
pg_graph-0.4.2 snippets/db.sql
pg_graph-0.4.1 snippets/db.sql
pg_graph-0.4.0 snippets/db.sql
pg_graph-0.3.6 snippets/db.sql
pg_graph-0.3.5 snippets/db.sql
pg_graph-0.3.4 snippets/db.sql
pg_graph-0.3.3 snippets/db.sql
pg_graph-0.3.2 snippets/db.sql
pg_graph-0.3.1 snippets/db.sql
pg_graph-0.3.0 snippets/db.sql
pg_graph-0.2.1 snippets/db.sql
pg_graph-0.2.0 snippets/db.sql
pg_graph-0.1.9 snippets/db.sql
pg_graph-0.1.8 snippets/db.sql
pg_graph-0.1.7 snippets/db.sql
pg_graph-0.1.6 snippets/db.sql