comment, interaction db
This commit is contained in:
parent
ee9015c1e3
commit
60d18771d7
17 changed files with 184 additions and 32 deletions
|
@ -1,3 +1,2 @@
|
|||
-- Add down migration script here
|
||||
DROP TABLE IF EXISTS "user";
|
||||
DROP TABLE IF EXISTS "role";
|
9
migrations/20241204225128_create_role_table.up.sql
Normal file
9
migrations/20241204225128_create_role_table.up.sql
Normal file
|
@ -0,0 +1,9 @@
|
|||
-- Add up migration script here
|
||||
CREATE TABLE IF NOT EXISTS "role"(
|
||||
id BIGSERIAL PRIMARY KEY NOT NULL UNIQUE,
|
||||
name VARCHAR(16) NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
INSERT INTO "role"(id, name) VALUES (0, 'Ahmet Kaan Gümüş');
|
||||
INSERT INTO "role"(id, name) VALUES (1, 'Founder');
|
||||
INSERT INTO "role"(id, name) VALUES (2, 'Normal');
|
2
migrations/20241204225135_create_user_table.down.sql
Normal file
2
migrations/20241204225135_create_user_table.down.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- Add down migration script here
|
||||
DROP TABLE IF EXISTS "user";
|
|
@ -1,13 +1,4 @@
|
|||
-- Add up migration script here
|
||||
CREATE TABLE IF NOT EXISTS "role"(
|
||||
id BIGSERIAL PRIMARY KEY NOT NULL UNIQUE,
|
||||
name VARCHAR(16) NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
INSERT INTO "role"(id, name) VALUES (0, 'Ahmet Kaan Gümüş');
|
||||
INSERT INTO "role"(id, name) VALUES (1, 'Founder');
|
||||
INSERT INTO "role"(id, name) VALUES (2, 'Normal');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "user"(
|
||||
id BIGSERIAL PRIMARY KEY NOT NULL UNIQUE,
|
||||
name VARCHAR(255) NOT NULL,
|
|
@ -1,5 +1,5 @@
|
|||
-- Add up migration script here
|
||||
CREATE TABLE "post"(
|
||||
CREATE TABLE IF NOT EXISTS "post"(
|
||||
creation_time TIMESTAMPTZ PRIMARY KEY UNIQUE NOT NULL,
|
||||
poster_id BIGSERIAL NOT NULL REFERENCES "user"(id),
|
||||
post VARCHAR NOT NULL UNIQUE
|
2
migrations/20241204225151_create_comment_table.down.sql
Normal file
2
migrations/20241204225151_create_comment_table.down.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- Add down migration script here
|
||||
DROP TABLE IF EXISTS "comment";
|
7
migrations/20241204225151_create_comment_table.up.sql
Normal file
7
migrations/20241204225151_create_comment_table.up.sql
Normal file
|
@ -0,0 +1,7 @@
|
|||
-- Add up migration script here
|
||||
CREATE TABLE IF NOT EXISTS "comment"(
|
||||
post_creation_time TIMESTAMPTZ NOT NULL REFERENCES "post"(creation_time),
|
||||
creation_time TIMESTAMPTZ PRIMARY KEY NOT NULL UNIQUE,
|
||||
commenter_id BIGSERIAL NOT NULL REFERENCES "user"(id),
|
||||
comment VARCHAR NOT NULL
|
||||
);
|
|
@ -0,0 +1,2 @@
|
|||
-- Add down migration script here
|
||||
DROP TABLE IF EXISTS "interaction";
|
|
@ -0,0 +1,5 @@
|
|||
-- Add up migration script here
|
||||
CREATE TABLE IF NOT EXISTS "interaction"(
|
||||
id BIGSERIAL PRIMARY KEY NOT NULL UNIQUE,
|
||||
name VARCHAR(10) UNIQUE NOT NULL
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue