taskmanagerapi-j4ys1j/alembic/versions/001_initial_migration.py
Automated Action 10172c55ca Implement comprehensive Task Manager API with FastAPI
Added complete task management functionality including:
- CRUD operations for tasks (create, read, update, delete)
- Task model with status (pending/in_progress/completed) and priority (low/medium/high)
- SQLite database with SQLAlchemy ORM
- Alembic migrations for database schema
- Pydantic schemas for request/response validation
- FastAPI routers with proper error handling
- Filtering and pagination support
- Health check endpoint
- CORS configuration
- Comprehensive API documentation
- Proper project structure following FastAPI best practices
2025-06-20 19:34:58 +00:00

47 lines
1.3 KiB
Python

"""Create tasks 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:
op.create_table(
"tasks",
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(
"status",
sa.Enum("PENDING", "IN_PROGRESS", "COMPLETED", name="taskstatus"),
nullable=False,
),
sa.Column(
"priority",
sa.Enum("LOW", "MEDIUM", "HIGH", name="taskpriority"),
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_tasks_id"), "tasks", ["id"], unique=False)
op.create_index(op.f("ix_tasks_title"), "tasks", ["title"], unique=False)
def downgrade() -> None:
op.drop_index(op.f("ix_tasks_title"), table_name="tasks")
op.drop_index(op.f("ix_tasks_id"), table_name="tasks")
op.drop_table("tasks")