feat: post routing

This commit is contained in:
Ahmet Kaan GÜMÜŞ 2024-12-15 04:30:39 +03:00
parent e167b864ee
commit dc849dd970
15 changed files with 185 additions and 26 deletions

View file

@ -1,6 +1,6 @@
-- Add up migration script here
CREATE TABLE IF NOT EXISTS "post"(
creation_time TIMESTAMPTZ PRIMARY KEY UNIQUE NOT NULL DEFAULT NOW(),
poster_id BIGSERIAL NOT NULL REFERENCES "user"(id),
user_id BIGSERIAL NOT NULL REFERENCES "user"(id),
post VARCHAR NOT NULL UNIQUE
);

View file

@ -2,6 +2,6 @@
CREATE TABLE IF NOT EXISTS "comment"(
post_creation_time TIMESTAMPTZ NOT NULL REFERENCES "post"(creation_time),
creation_time TIMESTAMPTZ PRIMARY KEY NOT NULL UNIQUE DEFAULT NOW(),
commenter_id BIGSERIAL NOT NULL REFERENCES "user"(id),
user_id BIGSERIAL NOT NULL REFERENCES "user"(id),
comment VARCHAR NOT NULL
);

View file

@ -1,7 +1,7 @@
-- Add up migration script here
CREATE TABLE IF NOT EXISTS "post_interaction"(
post_creation_time TIMESTAMPTZ NOT NULL REFERENCES "post"(creation_time),
user_id BIGSERIAL NOT NULL REFERENCES "user"(id),
interaction_id BIGSERIAL NOT NULL REFERENCES "interaction"(id),
interactor_id BIGSERIAL NOT NULL REFERENCES "user"(id),
interaction_time TIMESTAMPTZ PRIMARY KEY NOT NULL UNIQUE DEFAULT NOW()
);

View file

@ -1,7 +1,7 @@
-- Add up migration script here
CREATE TABLE IF NOT EXISTS "comment_interaction"(
comment_creation_time TIMESTAMPTZ NOT NULL REFERENCES "comment"(creation_time),
user_id BIGSERIAL NOT NULL REFERENCES "user"(id),
interaction_id BIGSERIAL NOT NULL REFERENCES "interaction"(id),
interactor_id BIGSERIAL NOT NULL REFERENCES "user"(id),
interaction_time TIMESTAMPTZ PRIMARY KEY NOT NULL UNIQUE DEFAULT NOW()
);