Merge pull request #10 from Danieli4/codex/add-offline-event-management-feature-4fd6nk
Fix Alembic script path for migrations
This commit is contained in:
commit
69a9cf9d33
|
|
@ -30,6 +30,13 @@ def run_migrations() -> None:
|
||||||
|
|
||||||
config = Config(str(ALEMBIC_CONFIG))
|
config = Config(str(ALEMBIC_CONFIG))
|
||||||
config.set_main_option("sqlalchemy.url", str(settings.database_url))
|
config.set_main_option("sqlalchemy.url", str(settings.database_url))
|
||||||
|
# Alembic трактует относительный script_location относительно текущей рабочей
|
||||||
|
# директории процесса. В тестах и фронтенд-сервере мы запускаем backend из
|
||||||
|
# корня репозитория, поэтому явно подсказываем абсолютный путь до папки с
|
||||||
|
# миграциями, чтобы `alembic` не падал с "Path doesn't exist: alembic".
|
||||||
|
config.set_main_option(
|
||||||
|
"script_location", str(Path(__file__).resolve().parents[1] / "alembic")
|
||||||
|
)
|
||||||
script = ScriptDirectory.from_config(config)
|
script = ScriptDirectory.from_config(config)
|
||||||
head_revision = script.get_current_head()
|
head_revision = script.get_current_head()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user