
Features: - Project structure setup - Database configuration with SQLAlchemy - Item model and CRUD operations - API endpoints for items - Alembic migrations - Health check endpoint - Comprehensive documentation generated with BackendIM... (backend.im)
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""Initial migration
|
|
|
|
Revision ID: 2fbbf2d05a82
|
|
Revises:
|
|
Create Date: 2025-05-14 12:00:00.000000
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '2fbbf2d05a82'
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# Create items table
|
|
op.create_table('items',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('name', sa.String(length=100), nullable=False),
|
|
sa.Column('description', sa.Text(), nullable=True),
|
|
sa.Column('price', sa.Integer(), nullable=False),
|
|
sa.Column('is_active', sa.Boolean(), nullable=False, server_default=sa.text('1')),
|
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)')),
|
|
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():
|
|
op.drop_index(op.f('ix_items_id'), table_name='items')
|
|
op.drop_table('items') |