fixing meal edit on teampltes page

This commit is contained in:
2025-10-02 08:22:40 -07:00
parent 342eceff1f
commit ecd8c375f7
18 changed files with 636 additions and 1458 deletions

View File

@@ -1,11 +1,17 @@
from logging.config import fileConfig
import logging
import os
import sys
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from alembic import context
# Add the project root to the Python path
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), '..')))
from app.database import Base
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
@@ -17,9 +23,7 @@ if config.config_file_name is not None:
# add your model's MetaData object here
# for 'autogenerate' support
# We create an empty metadata object since we're not using autogenerate
# and we have explicit migration files
target_metadata = None
target_metadata = Base.metadata
# other values from the config, defined by the needs of env.py,
# can be acquired:
@@ -43,7 +47,7 @@ def run_migrations_offline() -> None:
url = os.getenv('DATABASE_URL', config.get_main_option("sqlalchemy.url"))
context.configure(
url=url,
target_metadata=None,
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
)
@@ -72,7 +76,7 @@ def run_migrations_online() -> None:
with connectable.connect() as connection:
logging.info("DEBUG: Database connection established for alembic")
context.configure(
connection=connection, target_metadata=None
connection=connection, target_metadata=target_metadata
)
logging.info("DEBUG: Alembic context configured")

View File

@@ -0,0 +1,30 @@
"""Add is_deleted to TrackedMealFood
Revision ID: 2498205b9e48
Revises: d0c142fbf0b0
Create Date: 2025-10-02 13:22:15.674346
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '2498205b9e48'
down_revision: Union[str, None] = 'd0c142fbf0b0'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('tracked_meal_foods', sa.Column('is_deleted', sa.Boolean(), nullable=True, server_default='0'))
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('tracked_meal_foods', 'is_deleted')
# ### end Alembic commands ###