refactor: merge cover_image migration into 002_posts

- Add cover_image column directly in CREATE TABLE posts
- Remove standalone 003_post_cover_image.sql migration
This commit is contained in:
xfy 2026-06-03 15:41:22 +08:00
parent e48ea4f97f
commit b173a5c509
2 changed files with 5 additions and 6 deletions

View File

@ -8,6 +8,7 @@ CREATE TABLE posts (
content_md TEXT NOT NULL,
content_html TEXT,
cover_image VARCHAR(500),
status TEXT NOT NULL DEFAULT 'draft',
published_at TIMESTAMPTZ,
@ -36,3 +37,6 @@ CREATE TABLE post_tags (
CREATE INDEX idx_post_tags_post ON post_tags(post_id);
CREATE INDEX idx_post_tags_tag ON post_tags(tag_id);
-- 为封面图添加索引
CREATE INDEX idx_posts_cover ON posts(cover_image) WHERE cover_image IS NOT NULL;

View File

@ -1,5 +0,0 @@
-- 新增封面图字段
ALTER TABLE posts ADD COLUMN cover_image VARCHAR(500);
-- 为封面图添加索引
CREATE INDEX idx_posts_cover ON posts(cover_image) WHERE cover_image IS NOT NULL;