diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-03-24 19:43:12 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-03-24 20:25:01 +0000 |
commit | 761231a2a67b2d8817c10f2e5cd7d866005407f1 (patch) | |
tree | 7a7e54f5ad0f9eaace40a68c601e66339c3f001a | |
parent | 409721a23691a2cd865e2de1912cb0fa47e26680 (diff) | |
download | paste-761231a2a67b2d8817c10f2e5cd7d866005407f1.tar.gz paste-761231a2a67b2d8817c10f2e5cd7d866005407f1.tar.xz paste-761231a2a67b2d8817c10f2e5cd7d866005407f1.zip |
paste.db.connect: make migrations optional
-rw-r--r-- | paste/db.py | 5 |
1 files 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: |