+13
@@ -42,6 +42,19 @@ CREATE INDEX IF NOT EXISTS idx_posts_root_date
|
||||
ON posts(post_date, post_state)
|
||||
WHERE parent_id IS NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS post_images (
|
||||
id TEXT PRIMARY KEY,
|
||||
post_id TEXT NOT NULL REFERENCES posts(id) ON DELETE CASCADE,
|
||||
object_key TEXT NOT NULL UNIQUE,
|
||||
public_url TEXT NOT NULL,
|
||||
description TEXT NOT NULL DEFAULT '' CHECK (char_length(description) <= 500),
|
||||
position SMALLINT NOT NULL CHECK (position BETWEEN 0 AND 3),
|
||||
width INTEGER NOT NULL CHECK (width > 0),
|
||||
height INTEGER NOT NULL CHECK (height > 0),
|
||||
created_at TEXT NOT NULL,
|
||||
UNIQUE (post_id, position)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS post_votes (
|
||||
user_id TEXT NOT NULL REFERENCES users(id),
|
||||
post_id TEXT NOT NULL REFERENCES posts(id) ON DELETE CASCADE,
|
||||
|
||||
Reference in New Issue
Block a user