taskmanagerapi-daenmk/migrations/versions/6e1b8a0e43c1_create_task_table.py
Automated Action 3be833dc43 Implement Task Manager API with FastAPI and SQLite
- Set up project structure
- Configure SQLAlchemy models and database connection
- Set up Alembic for database migrations
- Create Pydantic schemas for API data validation
- Implement task CRUD operations
- Add task filtering and pagination
- Include health check endpoint
- Update README with setup and usage instructions
2025-06-04 20:37:13 +00:00

48 lines
1.5 KiB
Python

"""create task table
Revision ID: 6e1b8a0e43c1
Revises:
Create Date: 2023-09-20 10:00:00.000000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6e1b8a0e43c1'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# Create the task table
op.create_table(
'task',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=255), nullable=False),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('status', sa.String(length=50), nullable=True),
sa.Column('priority', sa.String(length=50), nullable=True),
sa.Column('due_date', sa.DateTime(), nullable=True),
sa.Column('completed', sa.Boolean(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
# Create indexes
op.create_index(op.f('ix_task_id'), 'task', ['id'], unique=False)
op.create_index(op.f('ix_task_title'), 'task', ['title'], unique=False)
op.create_index(op.f('ix_task_status'), 'task', ['status'], unique=False)
def downgrade():
# Drop indexes
op.drop_index(op.f('ix_task_status'), table_name='task')
op.drop_index(op.f('ix_task_title'), table_name='task')
op.drop_index(op.f('ix_task_id'), table_name='task')
# Drop the task table
op.drop_table('task')