
- Set up project structure - Created Task model with SQLAlchemy - Implemented SQLite database connection - Created Alembic migrations - Added Task CRUD endpoints - Added health endpoint - Updated README with project details generated with BackendIM... (backend.im)
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
"""create tasks table
|
|
|
|
Revision ID: 0001
|
|
Revises:
|
|
Create Date: 2025-05-14
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import sqlite
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '0001'
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
op.create_table(
|
|
'task',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('title', sa.String(length=100), nullable=False),
|
|
sa.Column('description', sa.Text(), nullable=True),
|
|
sa.Column('priority', sa.Enum('LOW', 'MEDIUM', 'HIGH', name='taskpriority'), default='MEDIUM'),
|
|
sa.Column('status', sa.Enum('TODO', 'IN_PROGRESS', 'DONE', name='taskstatus'), default='TODO'),
|
|
sa.Column('due_date', sa.DateTime(), nullable=True),
|
|
sa.Column('completed', sa.Boolean(), default=False),
|
|
sa.Column('created_at', sa.DateTime(), default=sa.func.now()),
|
|
sa.Column('updated_at', sa.DateTime(), default=sa.func.now(), onupdate=sa.func.now()),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_task_id'), 'task', ['id'], unique=False)
|
|
|
|
|
|
def downgrade():
|
|
op.drop_index(op.f('ix_task_id'), table_name='task')
|
|
op.drop_table('task') |