
- Set up project structure with FastAPI and dependency files - Configure SQLAlchemy with SQLite database - Implement user authentication using JWT tokens - Create comprehensive API routes for user management - Add health check endpoint for application monitoring - Set up Alembic for database migrations - Add detailed documentation in README.md
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""Initial migration
|
|
|
|
Revision ID: 01_initial_migration
|
|
Revises:
|
|
Create Date: 2023-05-10 12:00:00.000000
|
|
|
|
"""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "01_initial_migration"
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# Create users table
|
|
op.create_table(
|
|
"user",
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
sa.Column("email", sa.String(), nullable=False),
|
|
sa.Column("hashed_password", sa.String(), nullable=False),
|
|
sa.Column("full_name", sa.String(), nullable=True),
|
|
sa.Column("is_active", sa.Boolean(), nullable=True),
|
|
sa.Column("is_superuser", sa.Boolean(), 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_user_email"), "user", ["email"], unique=True)
|
|
op.create_index(op.f("ix_user_id"), "user", ["id"], unique=False)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index(op.f("ix_user_id"), table_name="user")
|
|
op.drop_index(op.f("ix_user_email"), table_name="user")
|
|
op.drop_table("user")
|