[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:
1 parent
7bbeb068a8
commit
64ce467f21
189 files changed
+13374
-5023
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import {Phone} from 'lucide-react';
|
||||
import {Menu, Phone} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {isSectionEnabled, stayBookingView, unitSpec} from '@/lib/derive';
|
||||
|
||||
@@ -7,10 +7,9 @@ import {isSectionEnabled, stayBookingView, unitSpec} from '@/lib/derive';
|
||||
*
|
||||
* ★ 메뉴를 <nav> + <a> 로 그대로 둔다. 자바스크립트로 만드는 메뉴는
|
||||
* 크롤러가 링크 그래프를 못 읽는다.
|
||||
*
|
||||
* ★ 사이트가 한 장이라 전부 앵커다. 예전에는 페이지 이동이 섞여 있어서
|
||||
* 라우터의 basename 을 타야 했는데(`<a href="/guide">` 는 호스트 루트로 가서 404),
|
||||
* 앵커만 남으니 그 문제가 없다.
|
||||
* ★ 모바일 메뉴도 <details> 다. 상태를 리액트로 들면 하이드레이션 전에는 안 열리고,
|
||||
* 그 사이에 누른 손님에게는 그냥 고장난 버튼이다.
|
||||
* ★ 사이트가 한 장이라 전부 앵커다.
|
||||
*/
|
||||
export function SiteHeader() {
|
||||
const payload = useSite();
|
||||
@@ -19,60 +18,105 @@ export function SiteHeader() {
|
||||
const items = [
|
||||
{label: '소개', href: '#about', show: isSectionEnabled(payload, 'intro')},
|
||||
{label: spec.label, href: '#units', show: payload.units.length > 0},
|
||||
// ★ 숙박에서 예약은 이 사이트의 목적지다. 근거(요금·창구)가 하나도 없으면 링크도 없다 —
|
||||
// 눌러도 아무 일 없는 메뉴는 고장으로 읽힌다. 판단은 stayBookingView() 한 곳이 한다.
|
||||
{label: '예약', href: '#booking', show: stayBookingView(payload) !== null},
|
||||
{label: '이용 정보', href: '#info', show: true},
|
||||
{label: '축제', href: '#festival', show: (payload.local.festivals?.length ?? 0) > 0},
|
||||
{label: '주변 정보', href: '#guide', show: isSectionEnabled(payload, 'local')},
|
||||
{label: '오시는 길', href: '#location', show: true},
|
||||
{label: 'FAQ', href: '#faq', show: payload.faqs.length > 0},
|
||||
].filter((item) => item.show);
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-40 w-full border-b border-black/8 bg-[color-mix(in_srgb,var(--color-surface)_92%,transparent)] backdrop-blur-md">
|
||||
<div className="shell flex h-16 items-center justify-between">
|
||||
<a href="#top" className="flex min-w-0 items-center gap-2">
|
||||
<header
|
||||
className="border-line sticky top-0 z-40 w-full border-b backdrop-blur-md"
|
||||
style={{backgroundColor: 'color-mix(in srgb, var(--tpl-surface, #fff) 88%, transparent)'}}
|
||||
>
|
||||
<div className="shell flex h-16 items-center justify-between gap-3">
|
||||
<a href="#top" className="flex min-w-0 items-center gap-2.5">
|
||||
<span
|
||||
className="serif flex size-7 shrink-0 items-center justify-center rounded-lg text-sm font-semibold text-white"
|
||||
style={{backgroundColor: 'var(--color-brand)'}}
|
||||
className="serif flex size-8 shrink-0 items-center justify-center rounded-md text-[length:var(--fs-sm)]"
|
||||
style={{
|
||||
backgroundColor: 'var(--color-brand)',
|
||||
color: 'var(--tpl-bg, #fff)',
|
||||
fontWeight: 'var(--tpl-heading-weight, 700)',
|
||||
}}
|
||||
aria-hidden
|
||||
>
|
||||
{payload.place.name.slice(0, 1)}
|
||||
</span>
|
||||
<span className="flex min-w-0 flex-col">
|
||||
<span className="serif truncate text-base font-bold leading-none tracking-tight sm:text-lg">
|
||||
{/*
|
||||
★ font-bold 를 뺐다 (2026-09-04, 사장님: "폰트가 헤더랑 맞지 않는다")
|
||||
워드마크와 섹션 제목은 같은 --tpl-font-heading 을 쓴다. 그런데 1안의 간판체(Gugi)는
|
||||
**굵기가 400 하나뿐**이라, 700 을 요구하면 브라우저가 가짜 굵게로 획을 뭉개 그린다.
|
||||
같은 서체인데 헤더만 번져 보였다. 굵기는 템플릿이 정한 값을 따른다.
|
||||
*/}
|
||||
<span
|
||||
className="serif truncate text-[length:var(--fs-lead)] leading-tight"
|
||||
style={{fontWeight: 'var(--tpl-heading-weight, 700)'}}
|
||||
>
|
||||
{payload.place.name}
|
||||
</span>
|
||||
{payload.place.englishName && (
|
||||
<span className="mt-0.5 truncate text-[10px] uppercase leading-tight tracking-wider opacity-50">
|
||||
<span className="text-muted truncate text-[10px] uppercase leading-tight tracking-[0.14em]">
|
||||
{payload.place.englishName}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav aria-label="주요 메뉴" className="hidden items-center gap-6 md:flex">
|
||||
<nav aria-label="주요 메뉴" className="hidden items-center gap-7 lg:flex">
|
||||
{items.map((item) => (
|
||||
<a
|
||||
key={item.label}
|
||||
href={item.href}
|
||||
className="py-1 text-sm font-medium opacity-70 transition-opacity hover:opacity-100"
|
||||
className="text-muted py-1 text-[length:var(--fs-sm)] font-medium transition-colors hover:text-current"
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
{payload.place.phone && (
|
||||
<a
|
||||
href={`tel:${payload.place.phone}`}
|
||||
className="flex items-center gap-1.5 rounded-xl px-3 py-2 text-xs font-semibold text-white transition-opacity hover:opacity-90"
|
||||
style={{backgroundColor: 'var(--color-brand)'}}
|
||||
>
|
||||
<Phone className="size-3.5" />
|
||||
<span className="hidden sm:inline">{payload.place.phone}</span>
|
||||
<span className="sm:hidden">전화</span>
|
||||
</a>
|
||||
)}
|
||||
<div className="flex shrink-0 items-center gap-1.5">
|
||||
{payload.place.phone && (
|
||||
<a
|
||||
href={`tel:${payload.place.phone}`}
|
||||
className="tap inline-flex items-center gap-1.5 rounded-lg px-3 text-[length:var(--fs-xs)] font-bold transition-opacity hover:opacity-90"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
<Phone className="size-4" />
|
||||
<span className="hidden sm:inline">{payload.place.phone}</span>
|
||||
<span className="sr-only sm:hidden">전화</span>
|
||||
</a>
|
||||
)}
|
||||
|
||||
{/* 좁은 화면의 전체 메뉴. 하단 탭은 네 자리뿐이라 소개·FAQ 로 갈 길이 여기밖에 없다. */}
|
||||
<details className="relative lg:hidden">
|
||||
<summary
|
||||
className="tap flex cursor-pointer items-center justify-center rounded-lg marker:content-none [&::-webkit-details-marker]:hidden"
|
||||
aria-label="메뉴 열기"
|
||||
>
|
||||
<Menu className="size-5" />
|
||||
</summary>
|
||||
<nav
|
||||
aria-label="전체 메뉴"
|
||||
className="border-line tpl-border absolute right-0 top-[calc(100%+0.5rem)] z-50 w-52 overflow-hidden rounded-xl border shadow-lg"
|
||||
style={{backgroundColor: 'var(--tpl-surface, #fff)'}}
|
||||
>
|
||||
<ul className="divide-line divide-y">
|
||||
{items.map((item) => (
|
||||
<li key={item.label}>
|
||||
<a
|
||||
href={item.href}
|
||||
className="tap flex items-center px-4 text-[length:var(--fs-sm)] font-medium"
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user