mirror of
https://github.com/sstent/foodplanner.git
synced 2026-03-25 14:45:24 +00:00
feat(phase): Complete Phase 1: Preparation & Schema Updates
This commit is contained in:
27
alembic/versions/7fdcc454e056_add_name_to_tracked_meal.py
Normal file
27
alembic/versions/7fdcc454e056_add_name_to_tracked_meal.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""add_name_to_tracked_meal
|
||||
|
||||
Revision ID: 7fdcc454e056
|
||||
Revises: e1c2d8d5c1a8
|
||||
Create Date: 2026-02-24 06:29:46.441129
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '7fdcc454e056'
|
||||
down_revision: Union[str, None] = 'e1c2d8d5c1a8'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column('tracked_meals', sa.Column('name', sa.String(), nullable=True))
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
with op.batch_alter_table('tracked_meals') as batch_op:
|
||||
batch_op.drop_column('name')
|
||||
@@ -148,8 +148,9 @@ class TrackedMeal(Base):
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
tracked_day_id = Column(Integer, ForeignKey("tracked_days.id"))
|
||||
meal_id = Column(Integer, ForeignKey("meals.id"))
|
||||
meal_id = Column(Integer, ForeignKey("meals.id"), nullable=True)
|
||||
meal_time = Column(String) # Breakfast, Lunch, Dinner, Snack 1, Snack 2, Beverage 1, Beverage 2
|
||||
name = Column(String, nullable=True) # For single food items or custom names
|
||||
|
||||
tracked_day = relationship("TrackedDay", back_populates="tracked_meals")
|
||||
meal = relationship("Meal")
|
||||
|
||||
@@ -4,5 +4,5 @@ This file tracks all major tracks for the project. Each track has its own detail
|
||||
|
||||
---
|
||||
|
||||
- [ ] **Track: Refactor the meal tracking system to decouple 'Journal Logs' from 'Cookbook Recipes'**
|
||||
- [~] **Track: Refactor the meal tracking system to decouple 'Journal Logs' from 'Cookbook Recipes'**
|
||||
*Link: [./tracks/meal_tracker_refactor_20250223/](./tracks/meal_tracker_refactor_20250223/)*
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
This plan outlines the steps for refactoring the meal tracking system to decouple "Journal Logs" from "Cookbook Recipes," resolving database pollution and improving system structure.
|
||||
|
||||
## Phase 1: Preparation & Schema Updates
|
||||
- [ ] Task: Create a new branch for the refactoring track.
|
||||
- [ ] Task: Add the 'name' column to the 'TrackedMeal' table and make 'meal_id' nullable in 'app/database.py'.
|
||||
- [ ] Task: Create and run an Alembic migration for the schema changes.
|
||||
- [x] Task: Create a new branch for the refactoring track.
|
||||
- [x] Task: Add the 'name' column to the 'TrackedMeal' table and make 'meal_id' nullable in 'app/database.py'.
|
||||
- [x] Task: Create and run an Alembic migration for the schema changes.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 1: Preparation & Schema Updates' (Protocol in workflow.md)
|
||||
|
||||
## Phase 2: Logic & Calculation Updates
|
||||
|
||||
Reference in New Issue
Block a user