taskmanagerapi-0dh7qd/alembic/versions/001_initial_task_table.py
Automated Action d09d61a7c8 Implement Task Manager API with FastAPI and SQLite
- Created FastAPI application structure with main.py and requirements.txt
- Setup SQLite database with SQLAlchemy models for tasks
- Implemented Alembic migrations for database schema management
- Added CRUD endpoints for task management (GET, POST, PUT, DELETE)
- Configured CORS middleware to allow all origins
- Added health endpoint and base route with API information
- Updated README with comprehensive documentation
- Applied code formatting with Ruff linter
2025-06-24 14:17:11 +00:00

36 lines
1.1 KiB
Python

"""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=20), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('updated_at', sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_index('ix_tasks_id', 'tasks', ['id'], unique=False)
op.create_index('ix_tasks_title', 'tasks', ['title'], unique=False)
def downgrade() -> None:
op.drop_index('ix_tasks_title', table_name='tasks')
op.drop_index('ix_tasks_id', table_name='tasks')
op.drop_table('tasks')