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

Commit 9e8a283d by Mick Hansen

Merge branch 'trezm-fixing_remove_column'

2 parents 4b379702 98a51363
......@@ -115,8 +115,11 @@ module.exports = (function() {
},
removeColumnQuery: function(tableName, attributeName) {
var query = 'ALTER TABLE `<%= tableName %>` DROP `<%= attributeName %>`;';
return Utils._.template(query)({ tableName: tableName, attributeName: attributeName });
var query = 'ALTER TABLE <%= tableName %> DROP <%= attributeName %>;';
return Utils._.template(query)({
tableName: this.quoteTable(tableName),
attributeName: this.quoteIdentifier(attributeName)
});
},
changeColumnQuery: function(tableName, attributes) {
......
......@@ -222,7 +222,7 @@ module.exports = (function() {
removeColumnQuery: function(tableName, attributeName) {
var query = 'ALTER TABLE <%= tableName %> DROP COLUMN <%= attributeName %>;';
return Utils._.template(query)({
tableName: this.quoteIdentifiers(tableName),
tableName: this.quoteTable(tableName),
attributeName: this.quoteIdentifier(attributeName)
});
},
......
'use strict';
var Support = require(__dirname + '/../support')
, expectsql = Support.expectsql
, current = Support.sequelize
, sql = current.dialect.QueryGenerator
, current = Support.sequelize;
// Notice: [] will be replaced by dialect specific tick/quote character when there is not dialect specific expectation but only a default expectation
suite(Support.getTestDialectTeaser('SQL'), function() {
suite('removeColumn', function () {
test('schema', function () {
expectsql(sql.removeColumnQuery({
schema: 'archive',
tableName: 'user'
}, 'email'), {
default: "ALTER TABLE [archive].[user] DROP COLUMN [email];",
mysql: "ALTER TABLE `archive.user` DROP `email`;"
});
});
});
});
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!