CREATE TABLE "articles" (
  "id" bigserial,
  "title" varchar(50) NOT NULL,
  "cover" varchar(255) DEFAULT '{{.Values.web.default.cover}}',
  "content" text,
  "published" date DEFAULT CURRENT_DATE,
  PRIMARY KEY ("id")
);

CREATE TABLE "news" (
  "id" bigserial,
  "title" varchar(50) NOT NULL,
  "cover" varchar(255) DEFAULT '{{.Values.web.default.cover}}',
  "content" text,
  "published" date DEFAULT CURRENT_DATE,
  "related" varchar(255),
  PRIMARY KEY ("id")
);

CREATE TABLE "users" (
  "id" bigserial,
  "name" varchar(50) NOT NULL,
  "profile" varchar(255) NOT NULL DEFAULT '{{.Values.web.default.avatar}}',
  "account" varchar(255) NOT NULL UNIQUE,
  "password" varchar(255) NOT NULL,
  "ip" varchar(50),
  PRIMARY KEY ("id")
);

CREATE TABLE "comments" (
  "id" bigserial,
  "content" varchar(255) NOT NULL,
  "published" date DEFAULT CURRENT_DATE,
  "u_id" int8,
  "a_id" int8 NOT NULL,
  PRIMARY KEY ("id"),
  CONSTRAINT fk_comments_articles FOREIGN KEY ("a_id") REFERENCES "articles" ("id"),
  CONSTRAINT fk_comments_users FOREIGN KEY ("u_id") REFERENCES "users" ("id")
);