restapiservice-fozejt/alembic/versions/001_initial_migration.py
Automated Action d84f05f712 Create FastAPI REST API service with user management
- Set up FastAPI application with proper project structure
- Configure SQLite database with SQLAlchemy ORM
- Implement user model with CRUD operations
- Add Alembic for database migrations
- Create comprehensive API endpoints for user management
- Configure CORS middleware for cross-origin requests
- Add health check endpoint and service information
- Set up Ruff for code linting and formatting
- Update README with complete documentation

Co-Authored-By: BackendIM <noreply@backendim.com>
2025-06-18 07:32:46 +00:00

42 lines
1.3 KiB
Python

"""Initial migration
Revision ID: 001
Revises:
Create Date: 2024-01-01 12:00:00.000000
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '001'
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('users',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('email', sa.String(), nullable=False),
sa.Column('full_name', sa.String(), nullable=False),
sa.Column('hashed_password', sa.String(), nullable=False),
sa.Column('is_active', sa.Boolean(), 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_users_email'), 'users', ['email'], unique=True)
op.create_index(op.f('ix_users_id'), 'users', ['id'], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_users_id'), table_name='users')
op.drop_index(op.f('ix_users_email'), table_name='users')
op.drop_table('users')
# ### end Alembic commands ###