From 52a5ccc00236ef2773a0e6083fda487910b4ea8d Mon Sep 17 00:00:00 2001 From: Marcos Prieto Date: Tue, 23 Jan 2024 15:57:07 +0100 Subject: [PATCH] Commit in pre-creation hooks to make changes visible in create_all Without the explicit commit create_all fails because the UUID extension is not present. --- h/db/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/h/db/__init__.py b/h/db/__init__.py index 28dc6424649..cc2baf04ce6 100644 --- a/h/db/__init__.py +++ b/h/db/__init__.py @@ -48,11 +48,13 @@ def pre_delete(engine): # pragma: no cover with engine.connect() as connection: connection.execute(text("DROP SCHEMA IF EXISTS report CASCADE")) + connection.commit() def pre_create(engine): # pragma: no cover with engine.connect() as connection: connection.execute(text('CREATE EXTENSION IF NOT EXISTS "uuid-ossp";')) + connection.commit() def post_create(engine): # pragma: no cover