We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8c92458 commit f060bdcCopy full SHA for f060bdc
pytest_invenio/fixtures.py
@@ -466,6 +466,19 @@ def database(appctx):
466
467
if not database_exists(str(db_.engine.url)):
468
create_database(str(db_.engine.url))
469
+
470
+ # Use unlogged tables for PostgreSQL
471
+ if db_.engine.name == "postgresql":
472
+ from sqlalchemy.ext.compiler import compiles
473
+ from sqlalchemy.schema import CreateTable
474
475
+ @compiles(CreateTable)
476
+ def _compile_unlogged(element, compiler, **kwargs):
477
+ return compiler.visit_create_table(element).replace(
478
+ "CREATE TABLE ",
479
+ "CREATE UNLOGGED TABLE ",
480
+ )
481
482
db_.create_all()
483
484
yield db_
0 commit comments