
- Set up project structure with FastAPI app - Implement items CRUD API endpoints - Configure SQLite database with SQLAlchemy - Set up Alembic migrations - Add health check endpoint - Enable CORS middleware - Create README with documentation
33 lines
943 B
Python
33 lines
943 B
Python
"""create items table
|
|
|
|
Revision ID: 53b8c3f67ecb
|
|
Revises:
|
|
Create Date: 2023-12-01 00:00:00.000000
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '53b8c3f67ecb'
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table('items',
|
|
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('created_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_items_id'), 'items', ['id'], unique=False)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index(op.f('ix_items_id'), table_name='items')
|
|
op.drop_table('items') |