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

Commit 4b344052 by sdepold

spec for rename

1 parent cee78cab
module.exports = {
up: function(migration, DataTypes) {
migration.renameTable('Person', 'User')
},
down: function(migration, DataTypes) {
migration.renameTable('User', 'Person')
}
}
......@@ -92,7 +92,7 @@ describe('Migrator', function() {
SequelizeMeta.create({ lastMigrationId: '20111117063700' }).success(function() {
migrator.getUndoneMigrations(function(err, migrations) {
expect(err).toBeFalsy()
expect(migrations.length).toEqual(2)
expect(migrations.length).toEqual(3)
expect(migrations[0].filename).toEqual('20111123060700-addBirthdateToPerson.js')
done()
})
......@@ -153,5 +153,26 @@ describe('Migrator', function() {
// should not timeout
})
})
it("executes migration #20111205064000 and renames a table", function() {
Helpers.async(function(done) {
sequelize.getQueryInterface().showAllTables().success(function(tableNames) {
tableNames = tableNames.filter(function(e){ return e != 'SequelizeMeta' })
expect(tableNames.length).toEqual(1)
expect(tableNames[0]).toEqual('Person')
})
})
Helpers.async(function(done) {
setup({from: 20111205064000, to: 20111205064000})
migrator.migrate().success(done).error(function(err) { console.log(err) })
})
Helpers.async(function(done) {
sequelize.getQueryInterface().showAllTables().success(function(tableNames) {
tableNames = tableNames.filter(function(e){ return e != 'SequelizeMeta' })
expect(tableNames.length).toEqual(1)
expect(tableNames[0]).toEqual('User')
})
})
})
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!