From: garciadeblas Date: Tue, 10 Jan 2017 14:45:17 +0000 (+0100) Subject: Fixed length of some DB fields: path and name in table images, name in table flavors X-Git-Tag: v1.0.5 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=8eeb7a6cd7316c2d0b3766df9dfe78411b2c7e13;p=osm%2Fopenvim.git Fixed length of some DB fields: path and name in table images, name in table flavors Change-Id: I4e6be3c90fee055b171bd4ce60b28466149db89f Signed-off-by: garciadeblas --- diff --git a/database_utils/migrate_vim_db.sh b/database_utils/migrate_vim_db.sh index e008478..727a553 100755 --- a/database_utils/migrate_vim_db.sh +++ b/database_utils/migrate_vim_db.sh @@ -176,6 +176,7 @@ DATABASE_TARGET_VER_NUM=0 [ $OPENVIM_VER_NUM -ge 4002 ] && DATABASE_TARGET_VER_NUM=6 #0.4.2 => 6 [ $OPENVIM_VER_NUM -ge 4005 ] && DATABASE_TARGET_VER_NUM=7 #0.4.5 => 7 [ $OPENVIM_VER_NUM -ge 4010 ] && DATABASE_TARGET_VER_NUM=8 #0.4.10 => 8 +[ $OPENVIM_VER_NUM -ge 5001 ] && DATABASE_TARGET_VER_NUM=9 #0.5.1 => 9 #TODO ... put next versions here @@ -452,6 +453,21 @@ function downgrade_from_8(){ echo "DELETE FROM schema_version WHERE version_int = '8';" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 } +function upgrade_to_9(){ + echo " upgrade database from version 0.8 to version 0.9" + echo " change length of columns 'path' and 'name' to 255 in table 'images', and change length of column 'name' to 255 in table 'flavors'" + echo "ALTER TABLE images CHANGE COLUMN path path VARCHAR(255) NOT NULL AFTER uuid, CHANGE COLUMN name name VARCHAR(255) NOT NULL AFTER path;" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 + echo "ALTER TABLE flavors CHANGE COLUMN name name VARCHAR(255) NOT NULL AFTER uuid;" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 + echo "INSERT INTO schema_version (version_int, version, openvim_ver, comments, date) VALUES (9, '0.9', '0.5.1', 'increase length of columns path and name to 255 in table images, and change length of column name to 255 in table flavors', '2017-01-10');"| $DBCMD || ! echo "ERROR. Aborted!" || exit -1 +} +function downgrade_from_9(){ + echo " downgrade database from version 0.9 to version 0.8" + echo " change length of columns 'path' and 'name' to 100 and 64 in table 'images'" + echo "ALTER TABLE images CHANGE COLUMN path path VARCHAR(100) NOT NULL AFTER uuid, CHANGE COLUMN name name VARCHAR(64) NOT NULL AFTER path;" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 + echo "ALTER TABLE flavors CHANGE COLUMN name name VARCHAR(64) NOT NULL AFTER uuid;" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 + echo "DELETE FROM schema_version WHERE version_int = '9';" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 +} + #TODO ... put funtions here diff --git a/openvimd.py b/openvimd.py index 6513943..d85e5b1 100755 --- a/openvimd.py +++ b/openvimd.py @@ -30,9 +30,9 @@ and host controllers __author__="Alfonso Tierno" __date__ ="$10-jul-2014 12:07:15$" -__version__="0.5.0-r506" -version_date="Oct 2016" -database_version="0.8" #expected database schema version +__version__="0.5.1-r507" +version_date="Jan 2017" +database_version="0.9" #expected database schema version import httpserver import auxiliary_functions as af