modli-postgres
Advanced tools
Comparing version 3.2.0 to 3.3.0
{ | ||
"name": "modli-postgres", | ||
"version": "3.2.0", | ||
"version": "3.3.0", | ||
"description": "Modli adapter for PostgreSQL", | ||
@@ -5,0 +5,0 @@ "main": "src", |
@@ -19,2 +19,6 @@ const { Pool } = require('pg') | ||
getTable () { | ||
return this.schemaName ? `"${this.schemaName}"."${this.tableName}"` : this.tableName | ||
} | ||
/** | ||
@@ -52,3 +56,3 @@ * Runs query against instance conn | ||
let i = 1 | ||
let query = `CREATE TABLE IF NOT EXISTS ${this.tableName} (` | ||
let query = `CREATE TABLE IF NOT EXISTS ${this.getTable()} (` | ||
for (let prop in props) { | ||
@@ -83,3 +87,3 @@ let comma = (i !== len) ? ', ' : '' | ||
}, []) | ||
const query = `INSERT INTO ${this.tableName} (${cols.join(',')}) VALUES (${vals.join(',')})` | ||
const query = `INSERT INTO ${this.getTable()} (${cols.join(',')}) VALUES (${vals.join(',')})` | ||
return this.query(query) | ||
@@ -100,3 +104,3 @@ .then(data => { | ||
const where = query ? ` WHERE ${query}` : '' | ||
return this.query(`SELECT * FROM ${this.tableName}${where}`) | ||
return this.query(`SELECT * FROM ${this.getTable()}${where}`) | ||
.then((results) => { | ||
@@ -135,3 +139,3 @@ return results.rows.map((r) => { | ||
} | ||
return this.query(`UPDATE ${this.tableName} SET ${changes} WHERE ${query}`) | ||
return this.query(`UPDATE ${this.getTable()} SET ${changes} WHERE ${query}`) | ||
.then(data => { | ||
@@ -150,3 +154,3 @@ if (data.rowCount) return res | ||
delete (query) { | ||
return this.query(`DELETE FROM ${this.tableName} WHERE ${query}`) | ||
return this.query(`DELETE FROM ${this.getTable()} WHERE ${query}`) | ||
} | ||
@@ -153,0 +157,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137716
22
177
2