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
This commit is contained in:
Marty Oehme 2021-12-02 12:54:11 +01:00
parent bea6c0eca5
commit 0e31975cb0
Signed by: Marty
GPG key ID: B7538B8F50A1C800

View file

@ -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): def migrate(name):
db = create_database(name) db = create_database(name)
create_tables(db) create_tables(db)
create_constraints(db) create_constraints(db)
create_pragma(db)
return db return db