add migration for comments
This commit is contained in:
parent
ed85ece58a
commit
ed608f170a
@ -1,4 +1,6 @@
|
|||||||
DROP TABLE IF EXISTS location_images;
|
DROP TABLE IF EXISTS location_images;
|
||||||
|
DROP TABLE IF EXISTS client_ips;
|
||||||
|
DROP TABLE IF EXISTS user_reports;
|
||||||
DROP TABLE IF EXISTS reviews;
|
DROP TABLE IF EXISTS reviews;
|
||||||
DROP TABLE IF EXISTS locations;
|
DROP TABLE IF EXISTS locations;
|
||||||
DROP TABLE IF EXISTS regencies;
|
DROP TABLE IF EXISTS regencies;
|
||||||
@ -6,3 +8,7 @@ DROP TABLE IF EXISTS provinces;
|
|||||||
DROP TABLE IF EXISTS regions;
|
DROP TABLE IF EXISTS regions;
|
||||||
DROP TABLE IF EXISTS tags;
|
DROP TABLE IF EXISTS tags;
|
||||||
DROP TABLE IF EXISTS users;
|
DROP TABLE IF EXISTS users;
|
||||||
|
|
||||||
|
|
||||||
|
DROP TYPE IF EXISTS user_reports_type;
|
||||||
|
DROP TYPE IF EXISTS comment_type;
|
@ -1,20 +1,54 @@
|
|||||||
CREATE TABLE users(
|
CREATE TABLE users(
|
||||||
"id" serial primary key not null,
|
"id" serial primary key not null,
|
||||||
"email" varchar unique,
|
"email" varchar unique,
|
||||||
"username" varchar unique,
|
"username" varchar unique,
|
||||||
"password" varchar,
|
"password" varchar,
|
||||||
"avatar_picture" varchar,
|
"avatar_picture" varchar,
|
||||||
"google_sign_in_payload" varchar,
|
"google_sign_in_payload" varchar,
|
||||||
"banned_at" timestamp,
|
"banned_at" timestamp,
|
||||||
"banned_until" timestamp,
|
"banned_until" timestamp,
|
||||||
"is_admin" boolean,
|
"ban_reason" varchar,
|
||||||
"is_critics" boolean,
|
"is_permaban" boolean,
|
||||||
"is_verified" boolean,
|
"is_admin" boolean,
|
||||||
"ipv4_address" varchar(15) not null,
|
"is_critics" boolean,
|
||||||
"social_media" jsonb,
|
"is_verified" boolean,
|
||||||
"created_at" timestamp default(now()),
|
"social_media" jsonb,
|
||||||
"updated_at" timestamp default(now())
|
"created_at" timestamp default(now()),
|
||||||
);
|
"updated_at" timestamp default(now())
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE client_ips(
|
||||||
|
"id" serial primary key not null,
|
||||||
|
"ipv4" varchar(15) not null,
|
||||||
|
"ipv6" varchar(40),
|
||||||
|
"banned_at" timestamp,
|
||||||
|
"banned_until" timestamp,
|
||||||
|
"reason" varchar,
|
||||||
|
"is_permaban" boolean,
|
||||||
|
"created_at" timestamp default(now()),
|
||||||
|
"updated_at" timestamp default(now())
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TYPE user_reports_type as ENUM(
|
||||||
|
'comments',
|
||||||
|
'reviews',
|
||||||
|
'locations',
|
||||||
|
'users',
|
||||||
|
'stories'
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE user_reports(
|
||||||
|
"id" serial primary key not null,
|
||||||
|
"message" text not null,
|
||||||
|
"date" timestamp not null,
|
||||||
|
"report_target" integer not null,
|
||||||
|
"report_type" user_reports_type not null,
|
||||||
|
"submitted_by" integer references "users"("id") not null,
|
||||||
|
"created_at" timestamp default(now()),
|
||||||
|
"updated_at" timestamp default(now())
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE regions(
|
CREATE TABLE regions(
|
||||||
"id" serial primary key not null,
|
"id" serial primary key not null,
|
||||||
@ -80,5 +114,21 @@ CREATE TABLE reviews (
|
|||||||
"location_id" integer references "locations"("id") not null,
|
"location_id" integer references "locations"("id") not null,
|
||||||
"created_at" timestamp default(now()),
|
"created_at" timestamp default(now()),
|
||||||
"updated_at" timestamp default(now())
|
"updated_at" timestamp default(now())
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TYPE comment_type AS ENUM(
|
||||||
|
'stories',
|
||||||
|
'news',
|
||||||
|
'reviews'
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE comments(
|
||||||
|
"id" serial primary key not null,
|
||||||
|
"submitted_by" integer not null,
|
||||||
|
"comment_on" integer not null,
|
||||||
|
"comment_type" comment_type not null,
|
||||||
|
"reply_to" integer,
|
||||||
|
"is_hide" boolean,
|
||||||
|
"created_at" timestamp default(now()),
|
||||||
|
"updated_at" timestamp default(now())
|
||||||
);
|
);
|
Loading…
Reference in New Issue
Block a user