Files
sori.studio/db/migrations/061_page_listing_sections.sql
zenn 00999404a4 페이지 섹션·공개 목록 설정 누적 변경 일괄 반영
페이지 섹션 관리와 홈 Pages 진열장 연동, 공개 목록 표시개수 설정 관련 누적 로컬 변경을 기능 단위로 정리해 반영한다.
문서 이력과 패키지 버전을 v1.9.23으로 맞춰 코드와 문서 상태를 동기화한다.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 18:48:42 +09:00

19 lines
660 B
SQL

CREATE TABLE IF NOT EXISTS page_listing_sections (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL UNIQUE,
sort_order INTEGER NOT NULL DEFAULT 0,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
INSERT INTO page_listing_sections (name, sort_order)
SELECT DISTINCT
trim(listing_section) AS name,
dense_rank() OVER (ORDER BY trim(listing_section)) * 10 AS sort_order
FROM pages
WHERE trim(COALESCE(listing_section, '')) <> ''
ON CONFLICT (name) DO NOTHING;
CREATE INDEX IF NOT EXISTS page_listing_sections_sort_order_name_idx
ON page_listing_sections (sort_order ASC, name ASC);