@saltcorn/postgres 1.1.2-beta.11 → 1.1.2-beta.12
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 +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/postgres",
|
|
3
|
-
"version": "1.1.2-beta.
|
|
3
|
+
"version": "1.1.2-beta.12",
|
|
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": "1.1.2-beta.
|
|
15
|
+
"@saltcorn/db-common": "1.1.2-beta.12",
|
|
16
16
|
"pg": "^8.13.1",
|
|
17
17
|
"pg-copy-streams": "^6.0.6",
|
|
18
18
|
"replacestream": "4.0.3"
|
package/postgres.js
CHANGED
|
@@ -350,10 +350,10 @@ const getClient = async () => await pool.connect();
|
|
|
350
350
|
* @param {string} tblname - table name
|
|
351
351
|
* @returns {Promise<void>} no result
|
|
352
352
|
*/
|
|
353
|
-
const reset_sequence = async (tblname) => {
|
|
353
|
+
const reset_sequence = async (tblname, pkname = "id") => {
|
|
354
354
|
const sql = `SELECT setval(pg_get_serial_sequence('"${getTenantSchema()}"."${sqlsanitize(
|
|
355
355
|
tblname
|
|
356
|
-
)}"', '
|
|
356
|
+
)}"', '${pkname}'), coalesce(max("${pkname}"),0) + 1, false) FROM "${getTenantSchema()}"."${sqlsanitize(
|
|
357
357
|
tblname
|
|
358
358
|
)}";`;
|
|
359
359
|
await (client || pool).query(sql);
|