From 51d710f8197bd18583cf60a24d7314d6fca3da2c Mon Sep 17 00:00:00 2001 From: K Agajanian Date: Wed, 28 Aug 2024 14:14:51 -0600 Subject: [PATCH] url --- migrations/env.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/migrations/env.py b/migrations/env.py index 9bab402..2147056 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -29,6 +29,8 @@ # my_important_option = config.get_main_option("my_important_option") # ... etc. +url = os.getenv("DATABASE_URL") + def run_migrations_offline() -> None: """Run migrations in 'offline' mode. @@ -42,7 +44,7 @@ def run_migrations_offline() -> None: script output. """ - url = os.getenv("DATABASE_URL") + context.configure( url=url, target_metadata=target_metadata, @@ -61,8 +63,9 @@ def run_migrations_online() -> None: and associate a connection with the context. """ + connectable = engine_from_config( - config.get_section(config.config_ini_section, {}), + config.get_section(config.config_ini_section, {"url": url}), prefix="sqlalchemy.", poolclass=pool.NullPool, )