
- Fixed Pydantic configuration using ConfigDict for latest Pydantic version - Fixed import order in alembic/env.py for proper module imports - Applied code formatting with Ruff - Optimized database connection settings - Ensured proper error handling for API endpoints generated with BackendIM... (backend.im)
47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
"""initial setup
|
|
|
|
Revision ID: 001
|
|
Revises:
|
|
Create Date: 2025-05-13
|
|
|
|
"""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "001"
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# Create calculation table
|
|
op.create_table(
|
|
"calculation",
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
sa.Column("operation", sa.String(), nullable=False),
|
|
sa.Column("first_number", sa.Float(), nullable=False),
|
|
sa.Column("second_number", sa.Float(), nullable=True),
|
|
sa.Column("result", sa.Float(), nullable=False),
|
|
sa.Column(
|
|
"created_at",
|
|
sa.DateTime(timezone=True),
|
|
server_default=sa.text("CURRENT_TIMESTAMP"),
|
|
nullable=False,
|
|
),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_index(op.f("ix_calculation_id"), "calculation", ["id"], unique=False)
|
|
op.create_index(
|
|
op.f("ix_calculation_operation"), "calculation", ["operation"], unique=False
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index(op.f("ix_calculation_operation"), table_name="calculation")
|
|
op.drop_index(op.f("ix_calculation_id"), table_name="calculation")
|
|
op.drop_table("calculation")
|