rust_forum/migrations/20241204225151_create_comment_table.up.sql
2024-12-19 03:36:16 +03:00

7 lines
No EOL
312 B
SQL

-- Add up migration script here
CREATE TABLE IF NOT EXISTS "comment"(
creation_time TIMESTAMPTZ PRIMARY KEY NOT NULL UNIQUE DEFAULT NOW(),
post_creation_time TIMESTAMPTZ NOT NULL REFERENCES "post"(creation_time),
user_id BIGSERIAL NOT NULL REFERENCES "user"(id),
comment VARCHAR(8192) NOT NULL
);