@saltcorn/postgres 0.8.7-beta.3 → 0.8.7-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/postgres.js +5 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/postgres",
|
|
3
|
-
"version": "0.8.7-beta.
|
|
3
|
+
"version": "0.8.7-beta.5",
|
|
4
4
|
"description": "Postgres structures for Saltcorn, open-source no-code platform",
|
|
5
5
|
"homepage": "https://saltcorn.com",
|
|
6
6
|
"scripts": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"main": "index.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@saltcorn/db-common": "0.8.7-beta.
|
|
15
|
+
"@saltcorn/db-common": "0.8.7-beta.5",
|
|
16
16
|
"pg": "^8.2.1",
|
|
17
17
|
"pg-copy-streams": "^5.1.1"
|
|
18
18
|
},
|
package/postgres.js
CHANGED
|
@@ -75,11 +75,12 @@ const changeConnection = async (connObj = {}) => {
|
|
|
75
75
|
*/
|
|
76
76
|
const select = async (tbl, whereObj, selectopts = {}) => {
|
|
77
77
|
const { where, values } = mkWhere(whereObj);
|
|
78
|
+
const schema = selectopts.schema || getTenantSchema();
|
|
78
79
|
const sql = `SELECT ${
|
|
79
80
|
selectopts.fields ? selectopts.fields.join(", ") : `*`
|
|
80
|
-
} FROM "${
|
|
81
|
-
|
|
82
|
-
)}
|
|
81
|
+
} FROM "${schema}"."${sqlsanitize(tbl)}" ${where} ${mkSelectOptions(
|
|
82
|
+
selectopts
|
|
83
|
+
)}`;
|
|
83
84
|
sql_log(sql, values);
|
|
84
85
|
const tq = await pool.query(sql, values);
|
|
85
86
|
|
|
@@ -168,7 +169,7 @@ const insert = async (tbl, obj, opts = {}) => {
|
|
|
168
169
|
const fnameList = kvs.map(([k, v]) => `"${sqlsanitize(k)}"`).join();
|
|
169
170
|
var valPosList = [];
|
|
170
171
|
var valList = [];
|
|
171
|
-
const schema = getTenantSchema();
|
|
172
|
+
const schema = opts.schema || getTenantSchema();
|
|
172
173
|
kvs.forEach(([k, v]) => {
|
|
173
174
|
if (v && v.next_version_by_id) {
|
|
174
175
|
valPosList.push(
|