[odb-users] Data migration in SQLite

Boris Kolpackov boris at codesynthesis.com
Tue Dec 13 10:57:04 EST 2016


Hi Alexander,

Alexander Igorevich <alejandro_pnz at icloud.com> writes:

> Yea, I run it under debugger - it works like should works - after adding
> new class (2nd version), running next code segment:

You shouldn't even be running this code fragment with your version
pragma:

#pragma db model version(2, 2, open)

This says: "we support migration from oldest version 2 to current 
version 2". So when you run your code on database version 1 you
should get to the error condition (attempt to migrate from a
version that is too old) rather than to try and run any migration
steps.

What you perhaps meant is this pragma:

#pragma db model version(1, 2, open)

Boris



More information about the odb-users mailing list