
Implemented: - Basic arithmetic operations (add, subtract, multiply, divide) - Input validation - SQLite database with SQLAlchemy - Alembic migrations - Health endpoint generated with BackendIM... (backend.im)
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""Initial migration
|
|
|
|
Revision ID: d29a9efb00af
|
|
Revises:
|
|
Create Date: 2025-05-14 00:00:00.000000
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = 'd29a9efb00af'
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
op.create_table('calculations',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('operation', sa.String(), nullable=False),
|
|
sa.Column('num1', sa.Float(), nullable=False),
|
|
sa.Column('num2', sa.Float(), nullable=True),
|
|
sa.Column('result', sa.Float(), nullable=False),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_calculations_id'), 'calculations', ['id'], unique=False)
|
|
op.create_index(op.f('ix_calculations_operation'), 'calculations', ['operation'], unique=False)
|
|
|
|
|
|
def downgrade():
|
|
op.drop_index(op.f('ix_calculations_operation'), table_name='calculations')
|
|
op.drop_index(op.f('ix_calculations_id'), table_name='calculations')
|
|
op.drop_table('calculations') |