관리자 레이아웃과 네비게이션 정리

This commit is contained in:
2026-05-13 10:23:18 +09:00
parent ec9f9ea57f
commit b490d5b90f
17 changed files with 484 additions and 164 deletions

View File

@@ -15,15 +15,24 @@ CREATE INDEX IF NOT EXISTS navigation_items_location_sort_order_idx
ON navigation_items (location, sort_order ASC, label ASC);
INSERT INTO navigation_items (label, url, location, sort_order, is_visible)
VALUES
('Home pages', '/', 'primary', 10, true),
('Tags', '/tags', 'primary', 20, true),
('Authors', '/pages/about', 'primary', 30, true),
('Style', '/post/hello-sori-studio', 'primary', 40, true),
('Post types', '/post/custom-writing-tool', 'primary', 50, true),
('Members', '/pages/contact', 'primary', 60, true),
('Landing pages', '/pages/projects', 'primary', 70, true),
('Portal', '/pages/links', 'footer', 10, true),
('Docs', '/pages/about', 'footer', 20, true),
('Projects', '/pages/projects', 'footer', 30, true)
ON CONFLICT DO NOTHING;
SELECT seed.label, seed.url, seed.location, seed.sort_order, seed.is_visible
FROM (
VALUES
('Home pages', '/', 'primary', 10, true),
('Tags', '/tags', 'primary', 20, true),
('Authors', '/pages/about', 'primary', 30, true),
('Style', '/post/hello-sori-studio', 'primary', 40, true),
('Post types', '/post/custom-writing-tool', 'primary', 50, true),
('Members', '/pages/contact', 'primary', 60, true),
('Landing pages', '/pages/projects', 'primary', 70, true),
('Portal', '/pages/links', 'footer', 10, true),
('Docs', '/pages/about', 'footer', 20, true),
('Projects', '/pages/projects', 'footer', 30, true)
) AS seed(label, url, location, sort_order, is_visible)
WHERE NOT EXISTS (
SELECT 1
FROM navigation_items existing
WHERE existing.location = seed.location
AND existing.label = seed.label
AND existing.url = seed.url
);

View File

@@ -0,0 +1,23 @@
-- 반복 마이그레이션 실행으로 생긴 동일 위치·상위·라벨·URL 메뉴 중복 정리
WITH ranked_navigation AS (
SELECT
id,
row_number() OVER (
PARTITION BY location, COALESCE(parent_id::text, ''), label, url
ORDER BY
CASE WHEN is_folder THEN 0 ELSE 1 END,
sort_order ASC,
created_at ASC,
id ASC
) AS row_rank
FROM navigation_items
)
DELETE FROM navigation_items
WHERE id IN (
SELECT id
FROM ranked_navigation
WHERE row_rank > 1
);
CREATE UNIQUE INDEX IF NOT EXISTS navigation_items_location_parent_label_url_unique_idx
ON navigation_items (location, COALESCE(parent_id::text, ''), label, url);