Upgrade of the db schema strategy for version jumps

Bug #643303 reported by Markus Korn on 2010-09-20
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zeitgeist Framework
Fix Released
Medium
Seif Lotfy

Bug Description

We have to discuss how to support versions jump in the upgrade path of our db schema, like from ("core", 0) to ("core", 2). This becomes even more important when we reach the next version.

For me there are two solution:
1.) write 'dummy' upgrade scripts, like core_0_2.py, which do not more than running core_0_1.run() and core_1_2.run() one after another
2.) add some magic to sql._do_schema_upgrade() which automatically tries to find an upgrade path and run the 'shortest' possible one.

There is an issue with both solutions: right now the upgrade mechanism is designed in a way that after each data upgrade the schema upgrade is done. In both solutions the schema upgrade will be done *after* the full upgrade path. This can be handled by solution 1.) in the sanest possible way, the downside is that 1.) does not scale well for big numbers of schema versions around.

Any Ideas?

Related branches

Markus Korn (thekorn) on 2010-09-20
Changed in zeitgeist:
importance: Undecided → Medium
Seif Lotfy (seif) wrote :

I tend to agree with solution 1)
However I wound suggest having an _upgrade folder with several python scripts (_core_1.py, _core_2.py, ...) which are then all executed in that order. This will make upgrades easier since one just needs to detect the current schema version and execute the scripts from the count.

Changed in zeitgeist:
status: New → Confirmed
Changed in zeitgeist:
milestone: none → 0.6
Seif Lotfy (seif) wrote :

OK +1 for 2)

Seif Lotfy (seif) on 2010-10-15
Changed in zeitgeist:
assignee: nobody → Seif Lotfy (seif)
Seif Lotfy (seif) on 2010-10-19
Changed in zeitgeist:
status: Confirmed → Triaged
Seif Lotfy (seif) on 2010-10-19
Changed in zeitgeist:
assignee: Seif Lotfy (seif) → nobody
Seif Lotfy (seif) wrote :

Here is a little python file Markus wrote that might be useful for this bug.

Seif Lotfy (seif) on 2010-10-23
Changed in zeitgeist:
assignee: nobody → Seif Lotfy (seif)
Seif Lotfy (seif) wrote :

I tried to fix the bug by simple detecting the current core schema and "i" and the iterating through all update scripts in form of 'core_"i"_"i+1"' its simple and straight forward. No looking for paths and leaving us to actually only worry about upgrade +1 increasing upgrade scripts. If the basic idea is OK I can propose for merging.
https://code.edge.launchpad.net/~seif/zeitgeist/fix-643303

Seif Lotfy (seif) on 2010-10-24
Changed in zeitgeist:
status: Triaged → In Progress
Seif Lotfy (seif) on 2010-10-25
Changed in zeitgeist:
status: In Progress → Fix Committed
Markus Korn (thekorn) on 2010-11-01
Changed in zeitgeist:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments