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

Commit c541ddc9 by Sascha Depold

renameTable is working for sqlite

1 parent b3ff055b
...@@ -229,6 +229,11 @@ module.exports = (function() { ...@@ -229,6 +229,11 @@ module.exports = (function() {
describeTableQuery: function(tableName) { describeTableQuery: function(tableName) {
var sql = "PRAGMA TABLE_INFO('<%= tableName %>')" var sql = "PRAGMA TABLE_INFO('<%= tableName %>')"
return Utils._.template(sql, { tableName: tableName }) return Utils._.template(sql, { tableName: tableName })
},
renameTableQuery: function(before, after) {
var query = "ALTER TABLE `<%= before %>` RENAME TO `<%= after %>`;"
return Utils._.template(query, { before: before, after: after })
} }
} }
......
...@@ -167,7 +167,7 @@ describe(Helpers.getTestDialectTeaser("Migrator"), function() { ...@@ -167,7 +167,7 @@ describe(Helpers.getTestDialectTeaser("Migrator"), function() {
}.bind(this)) }.bind(this))
}) })
;(dialect === 'sqlite' ? itEventually : it)("executes migration #20111205064000 and renames a table", function(done) { it("executes migration #20111205064000 and renames a table", function(done) {
this.sequelize.getQueryInterface().showAllTables().success(function(tableNames) { this.sequelize.getQueryInterface().showAllTables().success(function(tableNames) {
tableNames = tableNames.filter(function(e){ return e != 'SequelizeMeta' }) tableNames = tableNames.filter(function(e){ return e != 'SequelizeMeta' })
expect(tableNames).toEqual([ 'Person' ]) expect(tableNames).toEqual([ 'Person' ])
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!