Skip to content

Commit

Permalink
Commit in pre-creation hooks to make changes visible in create_all
Browse files Browse the repository at this point in the history
Without the explicit commit create_all fails because the UUID extension
is not present.
  • Loading branch information
marcospri committed Jan 24, 2024
1 parent d5562f3 commit 5e2821e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions h/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5e2821e

Please # to comment.