v1.4.5: 게시물 작성자·편집 링크·목록 요약 보정
- posts.author_id 마이그레이션 및 owner/admin 단일 계정 환경에서만 기존 글 backfill - 공개 상세: 글쓴이 본인일 때만 공유 옆 수정 링크 표시, 수정 시각 제거 - 목록 요약: excerpt 없을 때 본문 fallback, post-summary-clamp로 말줄임 처리 - 회원 세션 API에 isAdmin·role 추가
This commit is contained in:
24
db/migrations/032_add_post_author.sql
Normal file
24
db/migrations/032_add_post_author.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
ALTER TABLE posts
|
||||
ADD COLUMN IF NOT EXISTS author_id UUID REFERENCES users(id) ON DELETE SET NULL;
|
||||
|
||||
UPDATE posts
|
||||
SET author_id = (
|
||||
SELECT id
|
||||
FROM (
|
||||
SELECT id
|
||||
FROM users
|
||||
WHERE user_role IN ('owner', 'admin')
|
||||
OR is_admin = true
|
||||
) privileged_users
|
||||
LIMIT 1
|
||||
)
|
||||
WHERE author_id IS NULL
|
||||
AND (
|
||||
SELECT COUNT(*)
|
||||
FROM users
|
||||
WHERE user_role IN ('owner', 'admin')
|
||||
OR is_admin = true
|
||||
) = 1;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS posts_author_id_idx
|
||||
ON posts (author_id);
|
||||
Reference in New Issue
Block a user