feat: ✨ let database handles creation times
This commit is contained in:
parent
1e8d656711
commit
dca2abb62a
10 changed files with 22 additions and 22 deletions
|
@ -6,5 +6,6 @@ CREATE TABLE IF NOT EXISTS "user"(
|
|||
gender boolean NOT NULL,
|
||||
birth_date DATE NOT NULL,
|
||||
email VARCHAR(255) NOT NULL UNIQUE,
|
||||
role_id BIGSERIAL NOT NULL REFERENCES "role"(id)
|
||||
role_id BIGSERIAL NOT NULL REFERENCES "role"(id),
|
||||
creation_time TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
|
@ -1,6 +1,6 @@
|
|||
-- Add up migration script here
|
||||
CREATE TABLE IF NOT EXISTS "post"(
|
||||
creation_time TIMESTAMPTZ PRIMARY KEY UNIQUE NOT NULL,
|
||||
creation_time TIMESTAMPTZ PRIMARY KEY UNIQUE NOT NULL DEFAULT NOW(),
|
||||
poster_id BIGSERIAL NOT NULL REFERENCES "user"(id),
|
||||
post VARCHAR NOT NULL UNIQUE
|
||||
);
|
|
@ -1,7 +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,
|
||||
creation_time TIMESTAMPTZ PRIMARY KEY NOT NULL UNIQUE DEFAULT NOW(),
|
||||
commenter_id BIGSERIAL NOT NULL REFERENCES "user"(id),
|
||||
comment VARCHAR NOT NULL
|
||||
);
|
|
@ -3,5 +3,5 @@ CREATE TABLE IF NOT EXISTS "post_interaction"(
|
|||
post_creation_time TIMESTAMPTZ NOT NULL REFERENCES "post"(creation_time),
|
||||
interaction_id BIGSERIAL NOT NULL REFERENCES "interaction"(id),
|
||||
interactor_id BIGSERIAL NOT NULL REFERENCES "user"(id),
|
||||
interaction_time TIMESTAMPTZ PRIMARY KEY NOT NULL UNIQUE
|
||||
interaction_time TIMESTAMPTZ PRIMARY KEY NOT NULL UNIQUE DEFAULT NOW()
|
||||
);
|
|
@ -3,5 +3,5 @@ CREATE TABLE IF NOT EXISTS "comment_interaction"(
|
|||
comment_creation_time TIMESTAMPTZ NOT NULL REFERENCES "comment"(creation_time),
|
||||
interaction_id BIGSERIAL NOT NULL REFERENCES "interaction"(id),
|
||||
interactor_id BIGSERIAL NOT NULL REFERENCES "user"(id),
|
||||
interaction_time TIMESTAMPTZ PRIMARY KEY NOT NULL UNIQUE
|
||||
interaction_time TIMESTAMPTZ PRIMARY KEY NOT NULL UNIQUE DEFAULT NOW()
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue