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

Commit a3f7d94b by Joel Trost Committed by Matt Broadstone

Fixed schema delimiting

1 parent ec40906e
...@@ -160,7 +160,6 @@ module.exports = (function() { ...@@ -160,7 +160,6 @@ module.exports = (function() {
ignoreKeys = []; ignoreKeys = [];
for(var key in attributes){ for(var key in attributes){
//console.log('some more action', attributes.deletedAtThisTime);
var aliasKey = attributes[key].field || key; var aliasKey = attributes[key].field || key;
if(ignoreKeys.indexOf(aliasKey) < 0){ if(ignoreKeys.indexOf(aliasKey) < 0){
ignoreKeys.push(aliasKey); ignoreKeys.push(aliasKey);
...@@ -363,7 +362,7 @@ module.exports = (function() { ...@@ -363,7 +362,7 @@ module.exports = (function() {
var casKey2 = cascadeCheck[j]; var casKey2 = cascadeCheck[j];
if(attributes[casKey].referencesKey === attributes[casKey2].referencesKey){ if(attributes[casKey].referencesKey === attributes[casKey2].referencesKey){
console.warn('MSSQL does not support multiple cascade keys on the same reference, ' console.warn('MSSQL does not support multiple cascade keys on the same reference, '
+ 'we will removing them to make this work but we recommend restructuring your query.'); + 'we will remove them to make this work but we recommend restructuring your query.');
attributes[casKey].onDelete = ''; attributes[casKey].onDelete = '';
attributes[casKey].onUpdate = ''; attributes[casKey].onUpdate = '';
attributes[casKey2].onDelete = ''; attributes[casKey2].onDelete = '';
......
...@@ -246,14 +246,13 @@ module.exports = { ...@@ -246,14 +246,13 @@ module.exports = {
}, },
quoteTable: function(param, as) { quoteTable: function(param, as) {
var table = ''; var table = '';
if (as === true) { if (as === true) {
as = param.as || param.name || param; as = param.as || param.name || param;
} }
if (_.isObject(param)) { if (_.isObject(param)) {
if (param.schema) { if (param.schema) {
table += param.schema + '.'; table += param.schema + (param.delimiter || '.');
} }
table += param.tableName; table += param.tableName;
table = quoteIdentifier(table); table = quoteIdentifier(table);
...@@ -607,7 +606,6 @@ module.exports = { ...@@ -607,7 +606,6 @@ module.exports = {
if (attribute.references) { if (attribute.references) {
template.push(attributeMap.references); template.push(attributeMap.references);
template.push(this.quoteTable(attribute.references)); template.push(this.quoteTable(attribute.references));
if (attribute.referencesKey) { if (attribute.referencesKey) {
template.push('(' + quoteIdentifier(attribute.referencesKey) + ')'); template.push('(' + quoteIdentifier(attribute.referencesKey) + ')');
} else { } else {
...@@ -718,7 +716,6 @@ module.exports = { ...@@ -718,7 +716,6 @@ module.exports = {
return query.join(' '); return query.join(' ');
}, },
getJoinClause: function(model, include){ getJoinClause: function(model, include){
//console.log(include.through);
var query = []; var query = [];
var primaryKey = quoteIdentifier(model.primaryKeyAttribute); var primaryKey = quoteIdentifier(model.primaryKeyAttribute);
var joinType = include.required ? 'INNER JOIN' : 'LEFT OUTER JOIN'; var joinType = include.required ? 'INNER JOIN' : 'LEFT OUTER JOIN';
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!