Adds an 8th development stage that lets users keep a free-form journal alongside habit tracking, reusing the existing Google OAuth/DB/PWA infrastructure instead of a separate project. Users organize entries into custom categories, filter by a month calendar with day-detail drill-down, attach photos/videos (served via an authenticated route, never /static), tag entries, and pick multiple emotions per entry from a curated 9-option set. Includes a global journal prompt bank for lightweight guided journaling. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
46 lines
2.0 KiB
Python
46 lines
2.0 KiB
Python
"""remove the 5 satisfaction-scale moods, keep only the 9 named emotions
|
|
|
|
Revision ID: 0012_remove_satisfaction_moods
|
|
Revises: 0011_journal_entry_multi_mood
|
|
Create Date: 2026-08-04
|
|
|
|
기분 선택을 다중 선택으로 바꾼 뒤(0011) 만족도 스케일 5종(최고/좋음/보통/별로/힘듦)과 구체적 감정 9종을
|
|
같이 뒀는데, 다중 선택에서는 "행복"과 "좋음"처럼 겹치는 느낌을 주는 항목이 섞여 있으면 혼란스러워서
|
|
만족도 스케일 5종을 아예 없애고 구체적 감정 9종만 남긴다. 혹시 그 사이 저장된 행이 있으면(이 저장소
|
|
개발 환경에서는 없었음) 지워야 새 CHECK 제약을 걸 수 있다.
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "0012_remove_satisfaction_moods"
|
|
down_revision: Union[str, None] = "0011_journal_entry_multi_mood"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
REMOVED_MOODS = ("great", "good", "neutral", "bad", "awful")
|
|
REMAINING_MOODS = ("pain", "achievement", "anger", "excited", "calm", "happy", "worry", "tired", "sad")
|
|
|
|
|
|
def upgrade() -> None:
|
|
journal_entry_mood = sa.table("journal_entry_mood", sa.column("mood", sa.String))
|
|
op.execute(journal_entry_mood.delete().where(journal_entry_mood.c.mood.in_(REMOVED_MOODS)))
|
|
|
|
op.drop_constraint("ck_journal_entry_mood_mood", "journal_entry_mood", type_="check")
|
|
op.create_check_constraint(
|
|
"ck_journal_entry_mood_mood",
|
|
"journal_entry_mood",
|
|
"mood in (" + ",".join(f"'{v}'" for v in REMAINING_MOODS) + ")",
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_constraint("ck_journal_entry_mood_mood", "journal_entry_mood", type_="check")
|
|
op.create_check_constraint(
|
|
"ck_journal_entry_mood_mood",
|
|
"journal_entry_mood",
|
|
"mood in (" + ",".join(f"'{v}'" for v in REMAINING_MOODS + REMOVED_MOODS) + ")",
|
|
)
|
|
# 삭제된 행 자체는 복구하지 않는다(내용을 알 수 없음) — 제약만 원상복구.
|