[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

+137
View File
@@ -0,0 +1,137 @@
import {useSite} from '@/lib/site-context';
import {bookingLabel, bookingLinks, sectionName, unitSpec, unitViews} from '@/lib/derive';
import {SectionHead} from './SectionHead';
/**
* oasi 객실 안내 — 카드 격자가 아니라 **사진 한 장씩 내려가는 지면**이다.
*
* ★ `@/lib/ui/Section` 을 쓰지 않고 `<section>` 을 직접 그린다.
* 그쪽은 섹션마다 배경(`--tpl-surface`)과 아래 실선을 칠하는데, 이 안은 배경이
* 한 톤이고 면이 갈리지 않는 게 정체성이다 — 그걸 쓰면 색 띠가 생긴다.
* ★ 값은 상자에 넣지 않는다. 요금·스펙은 가는 실선 하나로만 구분한다.
* ★ 사진은 한 장도 빼지 않는다. 대표 한 장은 세로 캡션과 함께 크게, 나머지는
* 아래 작은 격자로 — 감추면 HTML 에서 사라져 검색·AI 가 못 본다.
* ★ 사진 틀은 높이를 고정한다. 자연 비율로 두면 객실마다 사진 높이가 제각각이라
* 지면이 아니라 무너진 격자가 된다 — 실측(stay3): 대표 사진 544×725 ↔ 544×306,
* 아래 2열 격자 268×178 · 268×335 · 268×268.
*/
export function Rooms() {
const payload = useSite();
const spec = unitSpec(payload);
const units = unitViews(payload);
const booking = bookingLinks(payload)[0];
if (units.length === 0) return null;
return (
/* data-oasi + pt-[var(--oasi-gap)]: 껍데기의 판 지우개를 건너뛰되(이미 투명하다)
섹션 사이 여백은 공용 섹션과 같은 값을 쓴다 — 여기만 다르면 리듬이 끊긴다. */
<section
id="units"
data-oasi
aria-labelledby="units-heading"
className="pt-[var(--oasi-gap)]"
>
<SectionHead
id="units"
title={sectionName(payload, spec.path, `${spec.label} ${units.length}개 안내`)}
/>
<ul className="space-y-20 lg:space-y-28">
{units.map((unit) => (
<li key={unit.unitId}>
{unit.images[0] && (
<figure className="relative mx-auto w-full max-w-[34rem]">
<img
src={unit.images[0].url}
alt={unit.images[0].alt}
loading="lazy"
decoding="async"
className="block h-[clamp(15rem,24vw,21rem)] w-full object-cover"
/>
{/* 세로 캡션은 한 줄로 묶는다(nowrap). 객실 이름이 길면
("A동 (일본식 가정집 느낌으로 …")) 세로쓰기가 오른쪽으로 여러 단을
만들어 액자 옆이 글자 벽이 된다. 잘려도 바로 아래 <h3> 에 전문이 있다. */}
<figcaption
className="text-muted absolute left-full top-0 ml-5 hidden max-h-full overflow-hidden text-ellipsis whitespace-nowrap text-[length:var(--fs-xs)] tracking-[0.14em] xl:block"
style={{writingMode: 'vertical-rl'}}
>
{unit.name}
</figcaption>
</figure>
)}
<h3 className="mt-8 text-[length:var(--fs-sm)] font-normal tracking-[0.08em]">
{unit.name}
</h3>
{/* 스펙은 칩 상자 대신 가운뎃점으로 잇는다 — 이 안에는 테두리 상자가 없다. */}
{unit.chips.length > 0 && (
<p className="text-muted mt-2 text-[length:var(--fs-xs)] leading-[1.9]">
{unit.chips.map((chip) => `${chip.label} ${chip.value}`).join(' · ')}
</p>
)}
{unit.intro && (
<p className="measure mt-4 text-[length:var(--fs-xs)] leading-[1.9]">{unit.intro}</p>
)}
{/* 요금은 한 값이 아니라 비교하는 값이다 — 주중만 적으면 손님이 주말을 모른 채 떠난다. */}
{/* 요금은 객실 정보에서 내지 않는다 — 사유는 sections/UnitsSection.tsx 의 같은 자리 주석. */}
{unit.rows.length > 0 && (
<dl className="divide-line border-line mt-6 divide-y border-t text-[length:var(--fs-xs)]">
{unit.rows.map((row) => (
<div key={row.label} className="flex items-baseline justify-between gap-6 py-2.5">
<dt className="text-muted shrink-0">{row.label}</dt>
<dd className="text-right">{row.value}</dd>
</div>
))}
</dl>
)}
{unit.images.length > 1 && (
<ul className="mx-auto mt-6 grid w-full max-w-[34rem] grid-cols-2 gap-2">
{unit.images.slice(1).map((image) => (
<li key={image.mediaId}>
<img
src={image.url}
alt={image.alt}
loading="lazy"
decoding="async"
className="block aspect-[4/3] w-full object-cover"
/>
</li>
))}
</ul>
)}
{(booking || payload.place.phone) && (
<p className="mt-6 flex flex-wrap items-center gap-x-8 text-[length:var(--fs-sm)]">
{booking && (
<a
href={booking.url}
target="_blank"
rel="noopener noreferrer"
className="tap inline-flex items-center underline underline-offset-[6px]"
style={{color: 'var(--color-brand)'}}
>
{bookingLabel(booking)} 예약
</a>
)}
{payload.place.phone && (
<a
href={`tel:${payload.place.phone}`}
className="tap text-muted inline-flex items-center underline underline-offset-[6px]"
>
{payload.place.phone}
</a>
)}
</p>
)}
</li>
))}
</ul>
</section>
);
}