
- Created FastAPI application with CRUD operations for tasks - Implemented SQLAlchemy models with Task entity - Added Pydantic schemas for request/response validation - Set up Alembic for database migrations - Configured SQLite database with proper file structure - Added health check and root endpoints - Included comprehensive API documentation - Applied CORS middleware for development - Updated README with detailed setup and usage instructions - Applied code formatting with ruff linter
38 lines
1.0 KiB
Python
38 lines
1.0 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(), 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_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")
|