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

Commit cfef3366 by Michael Kearns

Fix removeColumnQuery for mssql dialect

* As per the syntax tree at:

  https://msdn.microsoft.com/en-gb/library/ms190273.aspx

  the correct syntax for removing a column is:
    ALTER TABLE users DROP COLUMN name;
  instead of:
    ALTER TABLE users DROP name;
  which is instead the syntax to drop the 'name' constraint.
1 parent c9c00b45
...@@ -170,7 +170,7 @@ var QueryGenerator = { ...@@ -170,7 +170,7 @@ var QueryGenerator = {
}, },
removeColumnQuery: function(tableName, attributeName) { removeColumnQuery: function(tableName, attributeName) {
var query = 'ALTER TABLE <%= tableName %> DROP <%= attributeName %>;'; var query = 'ALTER TABLE <%= tableName %> DROP COLUMN <%= attributeName %>;';
return Utils._.template(query)({ return Utils._.template(query)({
tableName: this.quoteTable(tableName), tableName: this.quoteTable(tableName),
attributeName: this.quoteIdentifier(attributeName) attributeName: this.quoteIdentifier(attributeName)
......
...@@ -15,11 +15,11 @@ if (current.dialect.name !== 'sqlite') { ...@@ -15,11 +15,11 @@ if (current.dialect.name !== 'sqlite') {
schema: 'archive', schema: 'archive',
tableName: 'user' tableName: 'user'
}, 'email'), { }, 'email'), {
mssql: 'ALTER TABLE [archive].[user] DROP [email];', mssql: 'ALTER TABLE [archive].[user] DROP COLUMN [email];',
mysql: 'ALTER TABLE `archive.user` DROP `email`;', mysql: 'ALTER TABLE `archive.user` DROP `email`;',
postgres: 'ALTER TABLE "archive"."user" DROP COLUMN "email";', postgres: 'ALTER TABLE "archive"."user" DROP COLUMN "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!