Advertisement
aaa4Alex

Untitled

Sep 12th, 2020
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*create table stuff */
  2.  
  3. create table if not exists category
  4. (
  5.     id            serial not null primary key,
  6.     description varchar(200),
  7.     category_name varchar(40),
  8.     created_at    timestamp,
  9.     updated_at    time
  10. );
  11.  
  12. create table if not exists article
  13. (
  14.     id          serial not null primary key,
  15.     account_id  integer,
  16.     title       varchar(200),
  17.     description varchar(500),
  18.     content     text,
  19.     created_at  timestamp,
  20.     updated_at  timestamp,
  21.     constraint fk_account
  22.         foreign key (account_id)
  23.             references account (id)
  24.  
  25. );
  26.  
  27. create table if not exists article_category
  28. (
  29.     article_id  integer,
  30.     category_id integer,
  31.     constraint fk_article
  32.         foreign key (article_id)
  33.             references article (id),
  34.     constraint fk_category
  35.         foreign key (category_id)
  36.             references category (id)
  37. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement