"""create tasks table Revision ID: 78b33b9de3eb Revises: Create Date: 2023-09-01 12:00:00.000000 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '78b33b9de3eb' down_revision = None branch_labels = None depends_on = None def upgrade() -> None: # Create tasks table op.create_table( 'task', sa.Column('id', sa.Integer(), nullable=False), sa.Column('title', sa.String(255), nullable=False), 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(), nullable=False, server_default=sa.func.now()), sa.Column('updated_at', sa.DateTime(), nullable=False, server_default=sa.func.now(), onupdate=sa.func.now()), sa.PrimaryKeyConstraint('id') ) # Create index on title for faster lookups op.create_index(op.f('ix_task_id'), 'task', ['id'], unique=False) op.create_index(op.f('ix_task_title'), 'task', ['title'], unique=False) def downgrade() -> None: # Drop tasks table op.drop_index(op.f('ix_task_title'), table_name='task') op.drop_index(op.f('ix_task_id'), table_name='task') op.drop_table('task')