taskmanagementtool-93vwrd/alembic/versions/001_create_tasks_table.py
Automated Action 97c3923628 Build complete task management tool with FastAPI and SQLite
- Implemented CRUD operations for task management
- Added task status tracking (pending, in_progress, completed)
- Included priority levels (low, medium, high)
- Set up SQLite database with Alembic migrations
- Added filtering and pagination support
- Configured CORS for all origins
- Included health check endpoint
- Added comprehensive API documentation
- Formatted code with Ruff linting
2025-06-19 05:20:58 +00:00

57 lines
1.5 KiB
Python

"""Create tasks table
Revision ID: 001
Revises:
Create Date: 2024-01-01 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=200), 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(timezone=True),
server_default=sa.text("CURRENT_TIMESTAMP"),
nullable=True,
),
sa.Column(
"updated_at",
sa.DateTime(timezone=True),
server_default=sa.text("CURRENT_TIMESTAMP"),
nullable=True,
),
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")