From 77aaed814cd7484efa31679d4dd03b74f52dc64d Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Thu, 2 Jul 2026 12:50:26 +0900 Subject: [PATCH] fix(db): make remaining blog migrations idempotent --- .../V023__CustomerFriendlyLanguageUpdate.sql | 7 ++++--- .../V024__UpdateBlogsWithLatestTemplate.sql | 7 ++++--- .../V025__AddNineBlogPostsProper.sql | 19 ++++++++++--------- .../V026__AddBasePostsAndAssignCategories.sql | 4 +++- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/db/migrations/V023__CustomerFriendlyLanguageUpdate.sql b/db/migrations/V023__CustomerFriendlyLanguageUpdate.sql index 0b601fd..bd9c042 100644 --- a/db/migrations/V023__CustomerFriendlyLanguageUpdate.sql +++ b/db/migrations/V023__CustomerFriendlyLanguageUpdate.sql @@ -144,7 +144,7 @@ $$, 1, true, NOW() -); +) ON CONFLICT (slug) DO NOTHING; -- 2. 이번달 부가가치세 신고 INSERT INTO blog_posts (title, slug, content, category_id, is_published, created_at) @@ -280,7 +280,7 @@ $$, 1, true, NOW() -); +) ON CONFLICT (slug) DO NOTHING; -- 3. 프리랜서를 위한 종합소득세 신고 INSERT INTO blog_posts (title, slug, content, category_id, is_published, created_at) @@ -456,4 +456,5 @@ $$, 1, true, NOW() -); +) ON CONFLICT (slug) DO NOTHING; + diff --git a/db/migrations/V024__UpdateBlogsWithLatestTemplate.sql b/db/migrations/V024__UpdateBlogsWithLatestTemplate.sql index 781f5d6..5d80d4e 100644 --- a/db/migrations/V024__UpdateBlogsWithLatestTemplate.sql +++ b/db/migrations/V024__UpdateBlogsWithLatestTemplate.sql @@ -156,7 +156,7 @@ $$, 1, true, NOW() -); +) ON CONFLICT (slug) DO NOTHING; -- 2. 이번달 부가가치세 신고 INSERT INTO blog_posts (title, slug, content, category_id, is_published, created_at) @@ -311,7 +311,7 @@ $$, 1, true, NOW() -); +) ON CONFLICT (slug) DO NOTHING; -- 3. 프리랜서를 위한 종합소득세 신고 INSERT INTO blog_posts (title, slug, content, category_id, is_published, created_at) @@ -462,4 +462,5 @@ $$, 1, true, NOW() -); +) ON CONFLICT (slug) DO NOTHING; + diff --git a/db/migrations/V025__AddNineBlogPostsProper.sql b/db/migrations/V025__AddNineBlogPostsProper.sql index a98de7c..e968975 100644 --- a/db/migrations/V025__AddNineBlogPostsProper.sql +++ b/db/migrations/V025__AddNineBlogPostsProper.sql @@ -194,7 +194,7 @@ $$, '프리랜서,경비,소득세,절세,디자이너,유튜버,강사', NOW(), NOW() -); +) ON CONFLICT (slug) DO NOTHING; -- 2. 월세 신고하는 방법 INSERT INTO blog_posts (title, slug, content, category_id, is_published, seo_title, seo_description, tags, created_at, updated_at) @@ -358,7 +358,7 @@ $$, '월세,임대소득,부동산세,신고,절세,집주인', NOW(), NOW() -); +) ON CONFLICT (slug) DO NOTHING; -- 3. 자녀 증여세 계산하기 INSERT INTO blog_posts (title, slug, content, category_id, is_published, seo_title, seo_description, tags, created_at, updated_at) @@ -528,7 +528,7 @@ $$, '증여세,자녀,상속세,절세,기초공제,특별공제', NOW(), NOW() -); +) ON CONFLICT (slug) DO NOTHING; -- 4. 사업자 등록 타이밍 INSERT INTO blog_posts (title, slug, content, category_id, is_published, seo_title, seo_description, tags, created_at, updated_at) @@ -715,7 +715,7 @@ $$, '사업자등록,부가가치세,창업,타이밍,간이과세', NOW(), NOW() -); +) ON CONFLICT (slug) DO NOTHING; -- 5. 소상공인 간단 기장 INSERT INTO blog_posts (title, slug, content, category_id, is_published, seo_title, seo_description, tags, created_at, updated_at) @@ -938,7 +938,7 @@ $$, '기장,소상공인,카페,편의점,부가가치세,소득세', NOW(), NOW() -); +) ON CONFLICT (slug) DO NOTHING; -- 6. 스마트스토어 판매자 세무 INSERT INTO blog_posts (title, slug, content, category_id, is_published, seo_title, seo_description, tags, created_at, updated_at) @@ -1136,7 +1136,7 @@ $$, '스마트스토어,쿠팡,네이버,판매자,부가가치세,소득세', NOW(), NOW() -); +) ON CONFLICT (slug) DO NOTHING; -- 7. 부가가치세 신고 기한 INSERT INTO blog_posts (title, slug, content, category_id, is_published, seo_title, seo_description, tags, created_at, updated_at) @@ -1316,7 +1316,7 @@ $$, '부가가치세,신고,기한,25일,가산세,납부', NOW(), NOW() -); +) ON CONFLICT (slug) DO NOTHING; -- 8. 종합소득세 신고 완벽 가이드 INSERT INTO blog_posts (title, slug, content, category_id, is_published, seo_title, seo_description, tags, created_at, updated_at) @@ -1503,7 +1503,7 @@ $$, '종합소득세,신고,기한,5월,프리랜서,사업자', NOW(), NOW() -); +) ON CONFLICT (slug) DO NOTHING; -- 9. 연말정산 환급 최대화 INSERT INTO blog_posts (title, slug, content, category_id, is_published, seo_title, seo_description, tags, created_at, updated_at) @@ -1707,4 +1707,5 @@ $$, '연말정산,환급,공제,절세,회사원,기본공제', NOW(), NOW() -); +) ON CONFLICT (slug) DO NOTHING; + diff --git a/db/migrations/V026__AddBasePostsAndAssignCategories.sql b/db/migrations/V026__AddBasePostsAndAssignCategories.sql index c439fa2..af514f9 100644 --- a/db/migrations/V026__AddBasePostsAndAssignCategories.sql +++ b/db/migrations/V026__AddBasePostsAndAssignCategories.sql @@ -294,4 +294,6 @@ INSERT INTO blog_posts (title, slug, content, category_id, is_published, seo_tit - 회사에 제출 - 2월에 환급 -놓친 공제가 있으면 손해입니다.$$, 5, true, 'SEO Title', 'SEO Description', '연말정산,환급', NOW(), NOW()); +놓친 공제가 있으면 손해입니다.$$, 5, true, 'SEO Title', 'SEO Description', '연말정산,환급', NOW(), NOW()) +ON CONFLICT (slug) DO NOTHING; +