Skip to content

fix(PRB-1740): remove filter for query update without where #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
![Publish Github Package](https://github.com/letsfullstack/loopback-connector-postgresql/workflows/Publish%20Github%20Package/badge.svg)
![Publish Github Package](https://github.com/letsfullstack/loopback-connector-postgresql/workflows/Publish%20Github%20Package/badge.svg)

# Loopback PostgreSQL Connector no projeto ArboBackend

Faça o NPM install desse projeto e copie a pasta para node_modules/@letscomunica/loopback-connector-postgresql ( substitua a página caso exita )

# Loopback PostgreSQL Connector

Expand Down
12 changes: 6 additions & 6 deletions lib/migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')];
Expand Down Expand Up @@ -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.
Expand All @@ -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];
}
}
Expand All @@ -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];
}
}
Expand Down
6 changes: 0 additions & 6 deletions lib/postgresql.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,6 @@ PostgreSQL.prototype.executeSQL = function(sql, params, options, callback) {
debug('SQL: %s', sql);
}

if (sql && sql.match('UPDATE') && !sql.match('WHERE') && 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)));
});
}

function executeWithConnection(connection, done) {
connection.query(sql, params, function(err, data) {
// if(err) console.error(err);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"bluebird": "^3.4.6",
"debug": "^3.1.0",
"loopback-connector": "^4.2.2",
"pg": "^7.0.0",
"pg": "^8.11.3",
"strong-globalize": "^3.1.0",
"uuid": "^3.0.1"
},
Expand Down