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

Commit d7cc21b3 by Michael Kearns

Postgres: Use extractTableDetails with quoteTable

* tableName objects have a "tableName" property, not a "table"
  property
* addColumnQuery was broken by commit 3559ad, only on the
  mssql_can_remove_column_with_default branch
1 parent 39aafb51
...@@ -24,7 +24,7 @@ var QueryGenerator = { ...@@ -24,7 +24,7 @@ var QueryGenerator = {
tableName = tableName || {}; tableName = tableName || {};
return { return {
schema: tableName.schema || options.schema || 'public', schema: tableName.schema || options.schema || 'public',
tableName: _.isPlainObject(tableName) ? tableName.table : tableName, tableName: _.isPlainObject(tableName) ? tableName.tableName : tableName,
delimiter: tableName.delimiter || options.delimiter || '.' delimiter: tableName.delimiter || options.delimiter || '.'
}; };
}, },
......
...@@ -193,7 +193,7 @@ var QueryGenerator = { ...@@ -193,7 +193,7 @@ var QueryGenerator = {
}); });
return Utils._.template(query)({ return Utils._.template(query)({
table: this.quoteTable(table), table: this.quoteTable(this.extractTableDetails(table)),
attribute: attribute attribute: attribute
}); });
}, },
...@@ -201,7 +201,7 @@ var QueryGenerator = { ...@@ -201,7 +201,7 @@ var QueryGenerator = {
removeColumnQuery: function(tableName, attributeName) { removeColumnQuery: function(tableName, attributeName) {
var query = 'ALTER TABLE <%= tableName %> DROP COLUMN <%= attributeName %>;'; var query = 'ALTER TABLE <%= tableName %> DROP COLUMN <%= attributeName %>;';
return Utils._.template(query)({ return Utils._.template(query)({
tableName: this.quoteTable(tableName), tableName: this.quoteTable(this.extractTableDetails(tableName)),
attributeName: this.quoteIdentifier(attributeName) attributeName: this.quoteIdentifier(attributeName)
}); });
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!