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:
parent
e48ea4f97f
commit
b173a5c509
@ -8,6 +8,7 @@ CREATE TABLE posts (
|
|||||||
|
|
||||||
content_md TEXT NOT NULL,
|
content_md TEXT NOT NULL,
|
||||||
content_html TEXT,
|
content_html TEXT,
|
||||||
|
cover_image VARCHAR(500),
|
||||||
|
|
||||||
status TEXT NOT NULL DEFAULT 'draft',
|
status TEXT NOT NULL DEFAULT 'draft',
|
||||||
published_at TIMESTAMPTZ,
|
published_at TIMESTAMPTZ,
|
||||||
@ -35,4 +36,7 @@ CREATE TABLE post_tags (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX idx_post_tags_post ON post_tags(post_id);
|
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_post_tags_tag ON post_tags(tag_id);
|
||||||
|
|
||||||
|
-- 为封面图添加索引
|
||||||
|
CREATE INDEX idx_posts_cover ON posts(cover_image) WHERE cover_image IS NOT NULL;
|
||||||
@ -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;
|
|
||||||
Loading…
x
Reference in New Issue
Block a user