From 0e31975cb01e2f12aa9647a7391e839aabc3cc90 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 2 Dec 2021 12:54:11 +0100 Subject: [PATCH] Create missing PRAGMA values Created missing schema_version and user_version values for import. user_version is especially important here since Loop Habit looks for the corresponding sql schema migration files and does not find files for versions under 9. user_version = 23 or 24 seems correct for Loop Habit Tracker v2.0.3 (or rather, 2.0.x). Migration files here: https://github.com/iSoron/uhabits/tree/dev/uhabits-core/src/jvmMain/resources/migrations Used by migration helper, with an error message on non-existing version file here: https://github.com/iSoron/uhabits/blob/dev/uhabits-core/src/jvmMain/java/org/isoron/uhabits/core/database/MigrationHelper.kt --- habitmove/schema.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/habitmove/schema.py b/habitmove/schema.py index fc6c03c..8179209 100644 --- a/habitmove/schema.py +++ b/habitmove/schema.py @@ -64,8 +64,15 @@ def create_constraints(db): ) +def create_pragma(db): + c = db.cursor() + c.execute(""" PRAGMA user_version = 24; """) + c.execute(""" PRAGMA schema_version = 30; """) + + def migrate(name): db = create_database(name) create_tables(db) create_constraints(db) + create_pragma(db) return db