taskmanagerapi-43q96i/migrations/versions/00000000000_create_tasks_table.py
Automated Action 53bc4e0199 Implement Task Manager API
- Set up FastAPI application structure
- Create Task model with SQLAlchemy
- Implement CRUD operations for tasks
- Add API endpoints for tasks with filtering options
- Configure Alembic for database migrations
- Add health check endpoint
- Configure Ruff for linting
- Add comprehensive documentation in README.md
2025-06-10 14:48:01 +00:00

43 lines
1.2 KiB
Python

"""create tasks table.
Revision ID: 00000000000
Revises:
Create Date: 2023-10-01 00:00:00.000000
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '00000000000'
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
"""Create tasks table."""
op.create_table(
'tasks',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(255), nullable=False, index=True),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('completed', sa.Boolean(), default=False),
sa.Column('priority', sa.Integer(), default=1),
sa.Column('due_date', sa.DateTime(), nullable=True),
sa.Column('created_at', sa.DateTime(), server_default=sa.func.now()),
sa.Column(
'updated_at',
sa.DateTime(),
server_default=sa.func.now(),
onupdate=sa.func.now()
),
sa.PrimaryKeyConstraint('id'),
)
op.create_index(op.f('ix_tasks_id'), 'tasks', ['id'], unique=False)
def downgrade() -> None:
"""Drop tasks table."""
op.drop_index(op.f('ix_tasks_id'), table_name='tasks')
op.drop_table('tasks')