[refactor] postgres-init,solution: DB 구조 재편 — 스키마 해체 · 공용 콘텐츠 한 벌 · 마이그레이션 체계

도메인별 스키마(company·place·fact·local·site·job)를 걷어내고 public 한 벌로 폈다.
스키마 한정자가 붙은 순간부터 ORM·raw SQL·테스트 픽스처가 각자 그 이름을 들고 다녀야 했다.

- 공용 콘텐츠를 한 테이블로 되돌린다. spots·region_stories 를 따로 파 놓고 보니
  같은 성격이 세 곳으로 갈라져 있었다 — `area_contents` 가 처음부터 content_type 으로
  종류를 가르는 설계였고 그걸 쓰면 됐다. 관계(거리·숨김)만 `place_area_refs` 로 남긴다.
- migrations/ + scripts/migrate.py: `init.sql` 은 **DB 를 처음 만들 때만** 돈다. 파일에
  컬럼을 더해도 이미 데이터가 든 DB 에는 반영되지 않는다 — 실제로 TourAPI 가 주변 정보를
  받아 와도 저장할 곳이 없어 축제·맛집이 0건이었고, 화면에는 "그냥 안 나오는 것" 으로만 보였다.
  DECISIONS.md 가 예고한 그대로다("운영 DB 가 생기는 순간 다시 필요해진다").
  Alembic 을 쓰지 않는 이유는 스키마 정의가 이미 두 곳(ORM·init.sql)이라 세 번째를
  더하면 어긋날 자리가 하나 더 생기기 때문이다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
minaChoiandClaude Opus 5 committed 2026-09-09 17:08:02 +09:00
1 parent 7bbeb068a8
commit 64ce467f21
189 files changed
+13374 -5023

No files matched your search

+133
View File
@@ -0,0 +1,133 @@
/**
* 섹션 껍데기 — 모든 섹션이 이걸 쓴다.
*
* ★ 왜 하나로 모았나
* 섹션 15개가 저마다 `py-16 sm:py-24` · `border-b border-black/8` · 제목 마크업을
* 복사해 들고 있었다. 그래서 템플릿이 정한 여백(`--tpl-section-space`)이 아무 데도 안 쓰였고,
* 어두운 섹션에서 `border-black/8` 은 안 보였고, 한 곳을 고치면 나머지 열넷이 어긋났다.
*
* ★ 영문 대문자 눈썹(ABOUT · GALLERY · LOCATION …)과 장식 아이콘을 걷어냈다 (2026-09-02)
* 섹션마다 영문 라벨과 아이콘을 다는 건 **생성형 템플릿의 표식**이고, 국내 숙박·공간
* 사이트는 그렇게 쓰지 않는다. 한글 제목 하나면 무슨 섹션인지 다 안다.
* 제목 왼쪽의 짧은 강조선 하나만 남겼다 — 인쇄물의 소제목 규칙이다.
*
* ★ 바탕(tone)은 세 가지뿐이다. 섹션마다 새 배경색을 만들면 페이지가 색 띠의 나열이 된다.
*/
import type {ReactNode} from 'react';
import {useLayout} from '@/lib/layout';
import {SectionHead as ReservationHead} from '@/layouts/reservation/SectionHead';
import {SectionHead as OasiHead} from '@/layouts/oasi/SectionHead';
import {SectionHead as StudioHead} from '@/layouts/studio/SectionHead';
import {SectionHead as PastelHead} from '@/layouts/pastel/SectionHead';
import {SectionHead as EditorialHead} from '@/layouts/editorial/SectionHead';
export type SectionTone = 'base' | 'alt' | 'dark';
const TONE_STYLE: Record<SectionTone, {backgroundColor: string; color?: string}> = {
base: {backgroundColor: 'var(--tpl-surface, #ffffff)'},
alt: {backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)'},
// 어두운 면 위 글자는 흰색을 박지 않고 템플릿의 밝은 면 색을 쓴다.
dark: {backgroundColor: 'var(--tpl-inverse, #1c1917)', color: 'var(--tpl-bg, #ffffff)'},
};
export function Section({
id,
title,
lead,
tone = 'base',
aside,
footnote,
children,
wide,
bare,
}: {
id: string;
title: string;
/** 제목 아래 한 줄. 없으면 그리지 않는다 — 설명을 지어내지 않는다. */
lead?: string;
tone?: SectionTone;
/** 제목 줄 오른쪽(넓은 화면에서만 옆에 선다). 갯수·갱신일·바로가기 자리. */
aside?: ReactNode;
/** 맨 아래 작은 글씨 — 기준일·출처. */
footnote?: ReactNode;
children: ReactNode;
/** 화면 끝까지 쓰는 섹션은 shell 을 벗는다. */
wide?: boolean;
/**
* 제목 줄을 섹션이 그리지 않는다 — 본문 안(예: 사진 옆 칸)에 두는 편집형 레이아웃용.
* 이때 본문이 `id="<id>-heading"` 인 제목을 직접 그려야 한다(aria-labelledby 가 그걸 가리킨다).
*/
bare?: boolean;
}) {
/* ★ 제목 생김새는 템플릿의 얼굴이다. 여기 한 벌로 두면 어떤 안을 골라도 같은 사이트로 보인다. */
const layout = useLayout();
const Head =
layout === 'reservation'
? ReservationHead
: layout === 'oasi'
? OasiHead
: layout === 'studio'
? StudioHead
: layout === 'pastel'
? PastelHead
: layout === 'editorial'
? EditorialHead
: DefaultHead;
return (
<section
id={id}
aria-labelledby={`${id}-heading`}
className="border-line paper w-full border-b"
style={{...TONE_STYLE[tone], paddingBlock: 'var(--section-space)'}}
>
<div className={wide ? 'w-full' : 'shell'}>
{!bare && (
<div className={wide ? 'shell' : undefined}>
<Head id={id} title={title} lead={lead} aside={aside} />
</div>
)}
{children}
{footnote && (
<p className={`text-muted mt-5 text-[length:var(--fs-xs)] ${wide ? 'shell' : ''}`}>
{footnote}
</p>
)}
</div>
</section>
);
}
/** 기본 제목 — 제목 앞의 짧은 선 하나. 아이콘 대신 이것으로 섹션의 시작을 표시한다. */
function DefaultHead({
id,
title,
lead,
aside,
}: {
id: string;
title: string;
lead?: string;
aside?: ReactNode;
}) {
return (
<header className="mb-6 sm:mb-8">
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
<div className="min-w-0">
<h2 id={`${id}-heading`} className="h2 flex items-center gap-2.5">
<i aria-hidden className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">{title}</span>
</h2>
{lead && (
<p className="text-muted measure mt-2 pl-[calc(3px+0.625rem)] text-[length:var(--fs-sm)]">
{lead}
</p>
)}
</div>
{aside && <div className="shrink-0">{aside}</div>}
</div>
</header>
);
}