Close the connection after running the migrations

The pooled `connection` stayed open until garbage collection,
which emits a `ResourceWarning`
This commit is contained in:
Alexander Hess 2026-11-30 10:54:22 +01:00
commit e01421bb96
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -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 ""