fix(trade-dashboard): fix import errors and alembic migration
- database.py: remove dead pre-definition of DATABASE_URL with undefined db_user/db_pass variables - models.py: add missing Table import from sqlalchemy - alembic/env.py: replace deprecated run_async() with asyncio.run() (removed in SQLAlchemy 2.0) - alembic 001_initial: use raw SQL for CREATE TYPE instead of op.create_enum() which requires alembic_postgresql_enum Migration 001_initial successfully applied to trading_data DB.
This commit is contained in:
parent
6599249d65
commit
23c7c707d8
4 changed files with 8 additions and 16 deletions
|
|
@ -54,8 +54,9 @@ async def run_migrations_online() -> None:
|
|||
await connectable.dispose()
|
||||
|
||||
|
||||
import asyncio
|
||||
|
||||
if context.is_offline_mode():
|
||||
run_migrations_offline()
|
||||
else:
|
||||
from sqlalchemy.ext.asyncio import run_async # noqa: E402
|
||||
run_async(run_migrations_online())
|
||||
asyncio.run(run_migrations_online())
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ depends_on = None
|
|||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_enum("position_direction", "long", "short", schema="public", create_type=True)
|
||||
op.execute('CREATE TYPE position_direction AS ENUM (\'long\', \'short\')')
|
||||
|
||||
op.create_table(
|
||||
"positions",
|
||||
|
|
|
|||
Loading…
Reference in a new issue