
- Set up FastAPI project structure - Configure SQLite database with SQLAlchemy - Create Item model and schemas - Implement CRUD endpoints for inventory items - Set up Alembic for database migrations - Add comprehensive documentation
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
"""initial tables
|
|
|
|
Revision ID: 1a1f28ba16c2
|
|
Revises:
|
|
Create Date: 2024-05-12 00:00:00.000000
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '1a1f28ba16c2'
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('items',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('name', sa.String(), nullable=False),
|
|
sa.Column('description', sa.String(), nullable=True),
|
|
sa.Column('quantity', sa.Integer(), nullable=True),
|
|
sa.Column('price', sa.Float(), nullable=True),
|
|
sa.Column('category', sa.String(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_items_id'), 'items', ['id'], unique=False)
|
|
op.create_index(op.f('ix_items_name'), 'items', ['name'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_items_name'), table_name='items')
|
|
op.drop_index(op.f('ix_items_id'), table_name='items')
|
|
op.drop_table('items')
|
|
# ### end Alembic commands ### |