Files
cal_counter/migrations/versions/319d293f3017_.py
Stef b498f3693a Initial commit: Flask calorie counter app setup
Add base Flask application with user authentication, SQLAlchemy models for users, units, and food items, admin blueprint, and basic templates. Includes database migration setup, login form, and seed script for initial user creation.
2025-06-26 14:19:09 +02:00

57 lines
1.7 KiB
Python

"""empty message
Revision ID: 319d293f3017
Revises: aab8050e9c73
Create Date: 2025-06-26 10:35:18.540813
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '319d293f3017'
down_revision = 'aab8050e9c73'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('unit',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('symbol', sa.String(length=10), nullable=False),
sa.Column('name', sa.String(length=50), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name'),
sa.UniqueConstraint('symbol')
)
op.create_table('food_item',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=150), nullable=False),
sa.Column('amount', sa.Integer(), nullable=False),
sa.Column('unit_id', sa.Integer(), nullable=False),
sa.Column('energy', sa.Float(), nullable=True),
sa.Column('protein', sa.Float(), nullable=True),
sa.Column('carbs', sa.Float(), nullable=True),
sa.Column('sugar', sa.Float(), nullable=True),
sa.Column('fats', sa.Float(), nullable=True),
sa.Column('saturated_fats', sa.Float(), nullable=True),
sa.ForeignKeyConstraint(['unit_id'], ['unit.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.drop_table('units')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('units',
sa.Column('id', sa.INTEGER(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.drop_table('food_item')
op.drop_table('unit')
# ### end Alembic commands ###