fastapiendpointservice-i3drc1/alembic/versions/85bcd3a99d15_initial_migration.py
Automated Action 96f40fc562 Create FastAPI endpoint service
- Set up FastAPI project structure with best practices
- Implemented SQLAlchemy models with SQLite database
- Added Alembic for database migrations
- Created CRUD API endpoints for items
- Added health check endpoint
- Updated documentation

generated with BackendIM... (backend.im)
2025-05-13 19:03:02 +00:00

39 lines
1.1 KiB
Python

"""Initial migration
Revision ID: 85bcd3a99d15
Revises:
Create Date: 2023-05-13 00:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '85bcd3a99d15'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# Create items table
op.create_table(
'items',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('updated_at', sa.DateTime(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('description', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_items_id'), 'items', ['id'], unique=False)
op.create_index(op.f('ix_items_name'), 'items', ['name'], unique=False)
def downgrade() -> None:
op.drop_index(op.f('ix_items_name'), table_name='items')
op.drop_index(op.f('ix_items_id'), table_name='items')
op.drop_table('items')