diff --git a/server/migrations/0003_comments_table.sql b/server/migrations/0003_comments_table.sql index bbb261a..5eb8049 100644 --- a/server/migrations/0003_comments_table.sql +++ b/server/migrations/0003_comments_table.sql @@ -1,7 +1,7 @@ CREATE TABLE IF NOT EXISTS comments ( - id BIGSERIAL PRIMARY KEY, + id SERIAL PRIMARY KEY NOT NULL, parent_post_id BIGINT NOT NULL, - parent_comment_id BIGINT, + -- parent_comment_id BIGINT, author_user_id BIGINT NOT NULL, content TEXT NOT NULL, upvotes INTEGER NOT NULL DEFAULT 0, @@ -9,7 +9,7 @@ CREATE TABLE IF NOT EXISTS comments ( created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (parent_post_id) REFERENCES posts (id), - FOREIGN KEY (parent_comment_id) REFERENCES comments (id), + -- FOREIGN KEY (parent_comment_id) REFERENCES comments (id), FOREIGN KEY (author_user_id) REFERENCES users (id) ); @@ -43,5 +43,5 @@ FOR EACH ROW EXECUTE FUNCTION comments_set_updated_at(); CREATE INDEX comments_parent_post_id_index ON comments (parent_post_id); -CREATE INDEX comments_parent_comment_id_index ON comments (parent_comment_id); +-- CREATE INDEX comments_parent_comment_id_index ON comments (parent_comment_id); CREATE INDEX comments_user_id_index ON comments (author_user_id); \ No newline at end of file