Automated Action 5e499461d7 Create simple FastAPI Todo application
- Set up project structure with FastAPI
- Create Todo model with SQLAlchemy
- Set up Alembic for database migrations
- Implement CRUD operations for todos
- Add health endpoint
- Update README with setup and usage instructions

generated with BackendIM... (backend.im)
2025-05-13 05:00:15 +00:00

34 lines
992 B
Python

"""create todos table
Revision ID: 001
Revises:
Create Date: 2025-05-13
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import func
# revision identifiers, used by Alembic.
revision = '001'
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
op.create_table(
'todos',
sa.Column('id', sa.Integer(), nullable=False, primary_key=True),
sa.Column('title', sa.String(100), nullable=False),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('completed', sa.Boolean(), default=False),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=func.now(), nullable=False),
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=func.now(), nullable=False),
)
op.create_index(op.f('ix_todos_id'), 'todos', ['id'], unique=False)
def downgrade() -> None:
op.drop_index(op.f('ix_todos_id'), table_name='todos')
op.drop_table('todos')