todoapp-d7nzgy/alembic/versions/001_initial_migration.py
Automated Action a4fb722622 Implement complete Todo API with FastAPI
- Set up FastAPI application with CORS support
- Created SQLAlchemy models and database session management
- Implemented CRUD endpoints for todos with proper validation
- Added Alembic migrations for database schema
- Included health check and base information endpoints
- Added comprehensive README with API documentation
- Configured Ruff for code quality and linting
2025-06-20 02:31:29 +00:00

36 lines
972 B
Python

"""Create todos table
Revision ID: 001
Revises:
Create Date: 2025-06-20 12:00:00.000000
"""
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 todos table
op.create_table(
'todos',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=255), nullable=False),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('completed', sa.Boolean(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('updated_at', sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_todos_id'), 'todos', ['id'], unique=False)
def downgrade() -> None:
# Drop todos table
op.drop_index(op.f('ix_todos_id'), table_name='todos')
op.drop_table('todos')