Upgrading database scheme is broken for newly created databases
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zeitgeist Framework |
Fix Released
|
Critical
|
Markus Korn |
Bug Description
Todays newly created database version 2 broke the upgrade path, we have no upgrade script for 0 (which means 'no version entry found') to 2. This happens because no-existing databases do not have such table.
$ ZEITGEIST_
DEBUG:root:Checking for another running instance...
DEBUG:root:No running instances found.
INFO:zeitgeist.
DEBUG:zeitgeist
INFO:zeitgeist.
CRITICAL:
We have to check if we are operating on a new database.
(Side note: we need tests for upgrades....)
Related branches
Changed in zeitgeist: | |
status: | New → In Progress |
importance: | Undecided → Critical |
assignee: | nobody → Markus Korn (thekorn) |
There are two possible solutions for this issue:
1.) check if we are operating on an empty database
2.) change our upgrade function in a way that if a upgrade script is not found for X -> Z it tries to run X -> Y -> Z
For 1.) there are two possible ways: version( ) to return -1 if SQLITE_MASTER is empty
1.a.) check if file already exists before sqlite3.connect() to this file
1.b.) change _get_schema_
I vote for 1.a.) as a fix for this bug, and work on 2.) for the future.