feat: add WonderQ admin backend
Add FastAPI admin/public API service, database setup, Docker deployment files, docs, and tests.
This commit is contained in:
32
alembic/versions/0001_initial_schema.py
Normal file
32
alembic/versions/0001_initial_schema.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""Initial SQLAlchemy schema.
|
||||
|
||||
Revision ID: 0001_initial_schema
|
||||
Revises:
|
||||
Create Date: 2026-06-30
|
||||
"""
|
||||
|
||||
from alembic import context, op
|
||||
from sqlalchemy import inspect
|
||||
from app.database import Base
|
||||
from app import models # noqa: F401
|
||||
|
||||
|
||||
revision = "0001_initial_schema"
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
if context.is_offline_mode():
|
||||
Base.metadata.create_all(bind=bind, checkfirst=False)
|
||||
return
|
||||
existing_tables = set(inspect(bind).get_table_names())
|
||||
for table in Base.metadata.sorted_tables:
|
||||
if table.name not in existing_tables:
|
||||
table.create(bind)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
Base.metadata.drop_all(bind=op.get_bind(), checkfirst=not context.is_offline_mode())
|
||||
Reference in New Issue
Block a user