feat(db): corrected tables

Signed-off-by: SoXX <soxx@fenpa.ws>
This commit is contained in:
SoXX 2024-06-04 14:00:00 +02:00
parent ccb7cff4fc
commit 5aa1542074

View File

@ -17,14 +17,14 @@ CREATE TYPE TagType AS ENUM (
CREATE TABLE "Post" CREATE TABLE "Post"
( (
id VARCHAR(25) PRIMARY KEY, id VARCHAR(25) UNIQUE PRIMARY KEY,
rating Rating, rating Rating,
created_at TIMESTAMP created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
); );
CREATE TABLE "Source" CREATE TABLE "Source"
( (
id VARCHAR(25) PRIMARY KEY, id VARCHAR(25) UNIQUE PRIMARY KEY,
display_name TEXT, display_name TEXT,
domain TEXT NOT NULL UNIQUE domain TEXT NOT NULL UNIQUE
); );
@ -37,8 +37,8 @@ CREATE TABLE "Tag"
CREATE TABLE "User" CREATE TABLE "User"
( (
id TEXT PRIMARY KEY, id TEXT UNIQUE PRIMARY KEY,
created_at TIMESTAMP created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
); );
CREATE TABLE "PostReference" CREATE TABLE "PostReference"
@ -66,7 +66,7 @@ CREATE TABLE "UserFavorites"
( (
user_id TEXT REFERENCES "User" (id), user_id TEXT REFERENCES "User" (id),
post_id TEXT REFERENCES "Post" (id), post_id TEXT REFERENCES "Post" (id),
created_at TIMESTAMP, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (user_id, post_id) PRIMARY KEY (user_id, post_id)
); );