From 761231a2a67b2d8817c10f2e5cd7d866005407f1 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Fri, 24 Mar 2023 19:43:12 +0000 Subject: paste.db.connect: make migrations optional --- paste/db.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/paste/db.py b/paste/db.py index c48221f..fc1d98c 100644 --- a/paste/db.py +++ b/paste/db.py @@ -74,7 +74,7 @@ def migrate(connection: sqlite3.Connection, migrations: list[str]) -> None: @contextmanager def connect( - database: str, migrations: list[str] = migrations, **kwargs + database: str, migrations: Optional[list[str]] = migrations, **kwargs ) -> Iterator[sqlite3.Connection]: conn = sqlite3.connect(database, uri=True, **kwargs) conn.execute("PRAGMA foreign_keys = ON") @@ -84,7 +84,8 @@ def connect( conn.create_function( name="DATA_HASH", narg=1, func=_data_hash_udf, deterministic=True ) - migrate(conn, migrations) + if migrations is not None: + migrate(conn, migrations) try: yield conn finally: -- cgit v1.2.3-54-g00ecf