changeset 134:5757ae81d57e

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.
author Daniele Nicolodi <daniele@grinta.net>
date Fri, 14 Oct 2011 21:59:42 +0200
parents 2006f8a68358
children 57dbb265a02a
files src/ltpdarepo/__init__.py src/ltpdarepo/install.py src/ltpdarepo/upgrade.py
diffstat 3 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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(
--- 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()
--- 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()