X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=utils%2Ftest%2Fvnfcatalogue%2Fhelpers%2Fmigrate.js;h=3f4d892dcd83d13829a89b6f74aa65a15e028ed3;hb=25d99dbc0c41217abd369a48fce1f69d636b7134;hp=ec209053cbebd4f3f042550139f06c63fce3b64e;hpb=5e8a41834d417ccb6d6d219dd23e182396a1e01b;p=releng.git diff --git a/utils/test/vnfcatalogue/helpers/migrate.js b/utils/test/vnfcatalogue/helpers/migrate.js index ec209053c..3f4d892dc 100644 --- a/utils/test/vnfcatalogue/helpers/migrate.js +++ b/utils/test/vnfcatalogue/helpers/migrate.js @@ -10,10 +10,10 @@ var knex = require('knex')({ client: 'mysql', connection: { - host : 'localhost', - user : '*', - password : '*', - database : 'vnf_catalogue', + host : process.env.DB_HOST, + user : process.env.DB_USER, + password : process.env.DB_PASSWORD, + database : process.env.DB_DATABASE, charset : 'utf8' } }); @@ -28,6 +28,14 @@ function createTable(tableName) { if (Schema[tableName][key].type === 'text' && Schema[tableName][key].hasOwnProperty('fieldtype')) { column = table[Schema[tableName][key].type](key, Schema[tableName][key].fieldtype); } + else if (Schema[tableName][key].type === 'enum' && Schema[tableName][key].hasOwnProperty('values') && Schema[tableName][key].nullable === true) { + console.log(Schema[tableName][key].values); + column = table[Schema[tableName][key].type](key, Schema[tableName][key].values).nullable(); + } + else if (Schema[tableName][key].type === 'enum' && Schema[tableName][key].hasOwnProperty('values')) { + console.log(Schema[tableName][key].values); + column = table[Schema[tableName][key].type](key, Schema[tableName][key].values).notNullable(); + } else if (Schema[tableName][key].type === 'string' && Schema[tableName][key].hasOwnProperty('maxlength')) { column = table[Schema[tableName][key].type](key, Schema[tableName][key].maxlength); }