From 10f5fac0e7b383653f210dae8b92ddd68ecde602 Mon Sep 17 00:00:00 2001 From: Jacob Hinkle Date: Sun, 18 Sep 2022 19:43:05 -0400 Subject: [PATCH] Add schema_version on python side, with match test --- nancy/db.py | 3 +++ tests/test_db.py | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 tests/test_db.py diff --git a/nancy/db.py b/nancy/db.py index 573e26a..589e4a6 100644 --- a/nancy/db.py +++ b/nancy/db.py @@ -3,6 +3,9 @@ import os import sqlite3 +schema_version = 2 + + def init(path): """ Initialize a data store directory. diff --git a/tests/test_db.py b/tests/test_db.py new file mode 100644 index 0000000..a470c91 --- /dev/null +++ b/tests/test_db.py @@ -0,0 +1,8 @@ +def test_schema_version_match(): + import nancy + from nancy.version import schema_version + + cur = nancy._conn.cursor() + (db_schema_ver,) = cur.execute("PRAGMA user_version;").fetchone() + + assert schema_version == db_schema_ver