taskmanagerapi-dl9e8b/alembic/versions/001_create_tasks_table.py
Automated Action af0f9e1638 Build barebones task manager API with FastAPI and SQLite
- Create FastAPI application with CORS support
- Implement Task model with SQLAlchemy
- Set up database session and migrations with Alembic
- Add CRUD endpoints for task management
- Include health check and API documentation endpoints
- Configure Ruff for code formatting and linting
2025-06-18 00:22:56 +00:00

45 lines
1.1 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 = "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.String(), nullable=True),
sa.Column("completed", sa.Boolean(), nullable=True),
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)
def downgrade() -> None:
op.drop_index(op.f("ix_tasks_id"), table_name="tasks")
op.drop_table("tasks")