chore: import WonderQ project
This commit is contained in:
commit
f5a9e4403a
452 files changed
+34173
No files matched your search
@@ -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