diff --git a/lib/migration.js b/lib/migration.js index eeaf52c..4636d91 100644 --- a/lib/migration.js +++ b/lib/migration.js @@ -224,9 +224,9 @@ function mixinMigration(PostgreSQL) { if (self.idColumn(model) === actualField.column) { return; } - if (actualFieldNotPresentInModel(actualField, model)) { - sql.push('DROP COLUMN ' + self.escapeName(actualField.column)); - } + // if (actualFieldNotPresentInModel(actualField, model)) { + // sql.push('DROP COLUMN ' + self.escapeName(actualField.column)); + // } }); if (sql.length > 0) { sql = [sql.join(', ')]; @@ -559,7 +559,7 @@ function mixinMigration(PostgreSQL) { propName = propName && self.propertyName(model, propName[1]) || null; if (!(indexNames.indexOf(indexName) > -1) && !(propName && m.properties[propName] && m.properties[propName].index)) { - sql.push('DROP INDEX ' + self.escapeName(indexName)); + // sql.push('DROP INDEX ' + self.escapeName(indexName)); } else { // The index was found, verify that database matches what we're expecting. // first: check single column indexes. @@ -571,7 +571,7 @@ function mixinMigration(PostgreSQL) { !((!si.type || si.type === ai[indexName].type) && (!si.unique || si.unique === ai[indexName].unique)) ) { // Drop the index if the type or unique differs from the actual table - sql.push('DROP INDEX ' + self.escapeName(indexName)); + // sql.push('DROP INDEX ' + self.escapeName(indexName)); delete ai[indexName]; } } @@ -597,7 +597,7 @@ function mixinMigration(PostgreSQL) { } if (!identical) { - sql.push('DROP INDEX ' + self.escapeName(indexName)); + // sql.push('DROP INDEX ' + self.escapeName(indexName)); delete ai[indexName]; } } diff --git a/lib/postgresql.js b/lib/postgresql.js index 0a8a26c..c4f1eeb 100644 --- a/lib/postgresql.js +++ b/lib/postgresql.js @@ -123,7 +123,7 @@ PostgreSQL.prototype.executeSQL = function(sql, params, options, callback) { debug('SQL: %s', sql); } - if (sql && sql.match('UPDATE') && !sql.match('WHERE') && self.settings.blockUpdateWithoutWhere) { + if (sql && sql.match(/UPDATE/i) && !sql.match(/WHERE/i) && self.settings.blockUpdateWithoutWhere) { return process.nextTick(function() { callback(new Error(g.f('Você está executando um update sem WHERE. Corrija essa query, meu caro:',sql))); });