Mercurial > hg > ltpdarepo
changeset 13:fad020eceac0
Add support for forcing initial schema version in upgrades.
author | Daniele Nicolodi <daniele@grinta.net> |
---|---|
date | Mon, 27 Jun 2011 13:41:52 +0200 |
parents | 9883a35f89f3 |
children | 29aa9cbb321c |
files | src/ltpdarepo/upgrade.py |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ltpdarepo/upgrade.py Sat Jun 25 17:55:21 2011 +0200 +++ b/src/ltpdarepo/upgrade.py Mon Jun 27 13:41:52 2011 +0200 @@ -19,15 +19,17 @@ return func -def upgrade(): - conn = db.connect(host=HOSTNAME, db=DATABASE, - user=USERNAME, passwd=PASSWORD) +def upgrade(fromrev=None): + conn = db.connect(host=HOSTNAME, db=DATABASE, user=USERNAME, passwd=PASSWORD) curs = conn.cursor() # current schema version curs.execute("""SELECT value+0 FROM options WHERE name='version'""") schema = curs.fetchone()[0] + if fromrev is not None: + schema = fromrev + # filter applicable upgrade steps todo = filter(lambda x: x[0] >= schema, steps)