todobackendservice-c80jul/alembic/versions/0001_create_todo_table.py
Automated Action db2997cc83 Create FastAPI todo backend with SQLite
Generated with and Co-Authored by [BackendIM](https://backend.im)
2025-05-11 16:39:38 +00:00

33 lines
814 B
Python

"""create todo table
Revision ID: 0001
Revises:
Create Date: 2023-01-01
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0001'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
'todos',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(), nullable=False, index=True),
sa.Column('description', sa.String(), nullable=True),
sa.Column('completed', sa.Boolean(), default=False),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.func.now()),
sa.Column('updated_at', sa.DateTime(timezone=True), onupdate=sa.func.now()),
sa.PrimaryKeyConstraint('id')
)
def downgrade():
op.drop_table('todos')