From: garciadeblas Date: Tue, 14 Nov 2017 15:27:31 +0000 (+0100) Subject: updated DB to change type of ram in flavors table X-Git-Tag: v3.0.2~2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=259459f8b56a245dc4bc402948b351622024cf4b;p=osm%2Fopenvim.git updated DB to change type of ram in flavors table Change-Id: Ie7217ba7de985cce0e314631d9cb9e6c92e05b2d Signed-off-by: garciadeblas --- diff --git a/database_utils/migrate_vim_db.sh b/database_utils/migrate_vim_db.sh index 1a1bf95..8564b84 100755 --- a/database_utils/migrate_vim_db.sh +++ b/database_utils/migrate_vim_db.sh @@ -33,7 +33,7 @@ DBPORT="3306" DBNAME="vim_db" QUIET_MODE="" #TODO update it with the last database version -LAST_DB_VERSION=21 +LAST_DB_VERSION=22 # Detect paths MYSQL=$(which mysql) @@ -189,6 +189,7 @@ fi #[ $OPENVIM_VER_NUM -ge 5015 ] && DATABASE_TARGET_VER_NUM=19 #0.5.15 => 19 #[ $OPENVIM_VER_NUM -ge 5017 ] && DATABASE_TARGET_VER_NUM=20 #0.5.17 => 20 #[ $OPENVIM_VER_NUM -ge 5018 ] && DATABASE_TARGET_VER_NUM=21 #0.5.18 => 21 +#[ $OPENVIM_VER_NUM -ge 5021 ] && DATABASE_TARGET_VER_NUM=22 #0.5.21 => 22 # TODO ... put next versions here function upgrade_to_1(){ @@ -719,6 +720,19 @@ function downgrade_from_21(){ echo "DELETE FROM schema_version WHERE version_int = '21';" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 } +function upgrade_to_22(){ + echo " Changed type of ram in 'flavors' from SMALLINT to MEDIUMINT" + echo "ALTER TABLE flavors CHANGE COLUMN ram ram MEDIUMINT(7) UNSIGNED NULL DEFAULT NULL AFTER disk;" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 + echo "INSERT INTO schema_version (version_int, version, openvim_ver, comments, date) VALUES (22, '0.22', '0.5.21', 'Changed type of ram in flavors from SMALLINT to MEDIUMINT', '2017-11-14');"\ + | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 +} + +function downgrade_from_22(){ + echo " Changed type of ram in 'flavors' from MEDIUMINT to SMALLINT" + echo "ALTER TABLE flavors CHANGE COLUMN ram ram SMALLINT(5) UNSIGNED NULL DEFAULT NULL AFTER disk;" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 + echo "DELETE FROM schema_version WHERE version_int = '22';" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 +} + #TODO ... put funtions here diff --git a/osm_openvim/ovim.py b/osm_openvim/ovim.py index 53a39eb..9a70e1c 100755 --- a/osm_openvim/ovim.py +++ b/osm_openvim/ovim.py @@ -43,9 +43,9 @@ import openflow_conn __author__ = "Alfonso Tierno, Leonardo Mirabal" __date__ = "$06-Feb-2017 12:07:15$" -__version__ = "0.5.20-r536" -version_date = "Sep 2017" -database_version = 21 #needed database schema version +__version__ = "0.5.21-r537" +version_date = "Nov 2017" +database_version = 22 #needed database schema version HTTP_Bad_Request = 400 HTTP_Unauthorized = 401