
- Created comprehensive task management system with CRUD operations - Implemented SQLAlchemy models and database configuration - Added Alembic migrations for database schema management - Created FastAPI endpoints for task management with proper validation - Added health check endpoint and base URL information - Configured CORS middleware and OpenAPI documentation - Updated README with comprehensive API documentation - Code formatted and linted with Ruff
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
"""Create initial task table
|
|
|
|
Revision ID: 001
|
|
Revises:
|
|
Create Date: 2024-01-01 00: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("completed", sa.Boolean(), nullable=False),
|
|
sa.Column("priority", sa.String(length=10), nullable=False),
|
|
sa.Column("created_at", sa.DateTime(), nullable=False),
|
|
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
|
sa.Column("due_date", sa.DateTime(), 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")
|