@@ -56,6 +56,9 @@ func EnsurePostsSchema(ctx context.Context, pool *pgxpool.Pool) error {
|
||||
post_id UUID NOT NULL REFERENCES posts(id) ON DELETE CASCADE,
|
||||
tag_id INT NOT NULL REFERENCES tags(id) ON DELETE CASCADE,
|
||||
PRIMARY KEY (post_id, tag_id)
|
||||
)`)
|
||||
);
|
||||
ALTER TABLE posts ADD COLUMN IF NOT EXISTS post_type TEXT NOT NULL DEFAULT 'text';
|
||||
ALTER TABLE posts ALTER COLUMN category_id DROP NOT NULL;
|
||||
CREATE INDEX IF NOT EXISTS idx_posts_post_type ON posts(post_type)`)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user