不要怂,就是干,撸起袖子干!

Commit b8b7ef2f by Sascha Depold

make sure that the migrations are working correctly

1 parent 3e9d1f7b
Showing with 26 additions and 6 deletions
...@@ -280,17 +280,37 @@ ...@@ -280,17 +280,37 @@
node -e "var ld = require('lodash');var c = require('../../config/config.js'); console.log(JSON.stringify(ld.extend(c, c[process.env.DIALECT || 'mysql'])))" > config/config.json node -e "var ld = require('lodash');var c = require('../../config/config.js'); console.log(JSON.stringify(ld.extend(c, c[process.env.DIALECT || 'mysql'])))" > config/config.json
# drop all the tables # drop all the tables
sequelize="global.beforeEach = function(){};\ sequelize="global.beforeEach = function(){}; var Support = require('./support'); var sequelize = Support.createSequelizeInstance({ dialect: Support.getTestDialect() });"
var Support = require('./support');\
var sequelize = Support.createSequelizeInstance({ dialect: Support.getTestDialect() });\
"
node -e "$sequelize Support.clearDatabase(sequelize, function() {});" node -e "$sequelize Support.clearDatabase(sequelize, function() {});"
../../../bin/sequelize --migrate ../../../bin/sequelize --migrate
run node -e "$sequelize sequelize.getQueryInterface().showAllTables().success(function(tables){ tables.forEach(function(table){ console.log(table) }) })" run node -e "$sequelize sequelize.getQueryInterface().showAllTables().success(function(tables){ tables.sort().forEach(function(table){ console.log(table) }) })"
[ $status -eq 0 ] [ $status -eq 0 ]
[ "${lines[0]}" = "Person" ]
[ "${lines[1]}" = "SequelizeMeta" ] [ "${lines[1]}" = "SequelizeMeta" ]
} }
@test "--migrate executes the createPerson migration and creates the respective table" {
cd test/binary/tmp
rm -rf ./*
../../../bin/sequelize -i
cp ../../assets/migrations/*-createPerson.js ./migrations/
cat ../../support.js|sed s,/../,/../../../, > ./support.js
# adjust the config.json
node -e "var ld = require('lodash');var c = require('../../config/config.js'); console.log(JSON.stringify(ld.extend(c, c[process.env.DIALECT || 'mysql'])))" > config/config.json
# drop all the tables
sequelize="global.beforeEach = function(){}; var Support = require('./support'); var sequelize = Support.createSequelizeInstance({ dialect: Support.getTestDialect() });"
node -e "$sequelize Support.clearDatabase(sequelize, function() {});"
../../../bin/sequelize --migrate
run node -e "$sequelize sequelize.getQueryInterface().showAllTables().success(function(tables){ tables.sort().forEach(function(table){ console.log(table) }) })"
[ $status -eq 0 ]
[ "${lines[0]}" = "Person" ]
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!