# HG changeset patch # User Daniele Nicolodi # Date 1318622382 -7200 # Node ID 5757ae81d57e7b81771a6c481bb31a4720d8fdec # Parent 2006f8a683581d0ceba946ba1e525eb1430fad42 Make schema version an integer. This is to make version numbers comparison easier and to avoid any confusion of the database schema version with the software or toolbox release. diff -r 2006f8a68358 -r 5757ae81d57e src/ltpdarepo/__init__.py --- a/src/ltpdarepo/__init__.py Fri Oct 14 21:59:40 2011 +0200 +++ b/src/ltpdarepo/__init__.py Fri Oct 14 21:59:42 2011 +0200 @@ -9,7 +9,7 @@ from ltpdarepo.security import secure, require, authenticate -SCHEMA = 2.9 +SCHEMA = 29 app = Flask(__name__) @@ -28,7 +28,7 @@ # validate schema revision curs = g.db.cursor() - curs.execute("SELECT value+0 FROM options WHERE name='version'") + curs.execute("SELECT CAST(value AS UNSIGNED) FROM options WHERE name='version'") g.schema = curs.fetchone()[0] if g.schema != SCHEMA and '/static/' not in request.url: raise InternalServerError( diff -r 2006f8a68358 -r 5757ae81d57e src/ltpdarepo/install.py --- a/src/ltpdarepo/install.py Fri Oct 14 21:59:40 2011 +0200 +++ b/src/ltpdarepo/install.py Fri Oct 14 21:59:42 2011 +0200 @@ -86,7 +86,7 @@ end repeat; END;""") - curs.execute("""INSERT INTO `options` VALUES ('version','2.9')""") + curs.execute("""INSERT INTO `options` VALUES ('version', '29')""") conn.commit() conn.close() diff -r 2006f8a68358 -r 5757ae81d57e src/ltpdarepo/upgrade.py --- a/src/ltpdarepo/upgrade.py Fri Oct 14 21:59:40 2011 +0200 +++ b/src/ltpdarepo/upgrade.py Fri Oct 14 21:59:42 2011 +0200 @@ -335,7 +335,7 @@ conn.commit() -@register(2.8, 2.9) +@register(2.8, 29) def upgrade_28_29(conn): curs = conn.cursor()