refactor(db): postgres-init 2파일 체계로 통합 — 00-init.sql(스키마 전체) + temp-data.sql(시드)

- 00-init.sql: 구 01(도메인)+02(learning)+05(anchoring) 통합, 구 04(누적 ALTER)는 01에 기반영되어 폐기
- temp-data.sql: 구 03 시드 + 협상 카드 시드(일반 11장·와일드 5장, 멱등 가드, available=TRUE)
- card 테이블: script TEXT 전환 + tone·strategy_type 컬럼 추가, 카드 변수 9종 체계 문서화
- 참조 갱신: 루트 README·docker-compose 주석, schedules/anchoring conftest(00-init 적용)·README·문서
- anchoring 테스트 20건 통과, 신규 DB 초기화·멱등성 검증 완료

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
민헌andClaude Fable 5 committed 2026-07-07 10:20:44 +09:00
1 parent d9191420c1
commit 26f518ed6e
15 files changed
+596 -389

No files matched your search

+8 -3
View File
@@ -15,7 +15,7 @@ from anchoring import db as adb
from anchoring.config import load_config
CFG = load_config()
_SCHEMA_SQL = Path(__file__).resolve().parents[3] / "postgres-init" / "05-anchoring-schema.sql"
_SCHEMA_SQL = Path(__file__).resolve().parents[3] / "postgres-init" / "00-init.sql"
def _db_available() -> bool:
@@ -40,12 +40,17 @@ requires_db = pytest.mark.skipif(not DB_OK, reason="로컬 Postgres(negosium_db)
def _schema_statements() -> list[str]:
"""05-anchoring-schema.sql 에서 psql 메타(\\connect)·주석을 제거하고 문장 단위로 분리."""
"""00-init.sql 에서 psql 메타(\\connect)·주석을 제거하고 문장 단위로 분리.
이미 연결된 DB 에 멱등 적용하므로 클러스터 수준 구문(CREATE DATABASE \\gexec,
ALTER DATABASE)은 건너뛴다.
"""
lines = [
line for line in _SCHEMA_SQL.read_text().splitlines()
if not line.startswith("\\") and not line.strip().startswith("--")
]
return [s.strip() for s in "\n".join(lines).split(";") if s.strip()]
stmts = [s.strip() for s in "\n".join(lines).split(";") if s.strip()]
return [s for s in stmts if "\\gexec" not in s and not s.startswith("ALTER DATABASE")]
@pytest_asyncio.fixture