diff --git a/migrations/env.py b/migrations/env.py index 5b090b4..49d1ac8 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -31,7 +31,8 @@ def include_object(obj, _name, type_, _reflected, _compare_to): return True -engine = sa.create_engine(velofy_config.DATABASE_URI) +# Without a `pool`, the `connection` really closes after the migrations +engine = sa.create_engine(velofy_config.DATABASE_URI, poolclass=sa.pool.NullPool) test_schema = f"_{velofy_config.CLEAN_SCHEMA}" if os.getenv("TESTING") else ""