diff options
| author | Christian Cleberg <[email protected]> | 2026-04-11 12:59:47 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-11 12:59:47 -0500 |
| commit | bdbc11e8609b2a40d25b08b5baef17ce7201df77 (patch) | |
| tree | e6bef4aaf330c200fc47ed0fc517dd1695b768c4 /alembic/env.py | |
| parent | 84330037cc1e904067c71e5854a3a0336f9a1ee5 (diff) | |
| download | hutch-stats-bdbc11e8609b2a40d25b08b5baef17ce7201df77.tar.gz hutch-stats-bdbc11e8609b2a40d25b08b5baef17ce7201df77.tar.bz2 hutch-stats-bdbc11e8609b2a40d25b08b5baef17ce7201df77.zip | |
fix: run alembic migrations against DATABASE_URL in containers
Diffstat (limited to 'alembic/env.py')
| -rw-r--r-- | alembic/env.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/alembic/env.py b/alembic/env.py index 6fcbeb0..90f262b 100644 --- a/alembic/env.py +++ b/alembic/env.py @@ -1,6 +1,7 @@ from __future__ import annotations from logging.config import fileConfig +import os from alembic import context from sqlalchemy import engine_from_config, pool @@ -18,6 +19,10 @@ target_metadata = Base.metadata def get_database_url() -> str: + env_database_url = os.getenv("DATABASE_URL") + if env_database_url: + return env_database_url + configured_url = config.get_main_option("sqlalchemy.url") if configured_url: return configured_url |
