pgsql-client 4.17.0 → 4.18.0

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.
Files changed (3) hide show
  1. package/admin.js +10 -1
  2. package/esm/admin.js +10 -1
  3. package/package.json +3 -3
package/admin.js CHANGED
@@ -160,7 +160,16 @@ class DbAdmin {
160
160
  if (!(0, fs_1.existsSync)(file)) {
161
161
  throw new Error(`Missing SQL file: ${file}`);
162
162
  }
163
- this.run('psql', ['-f', file, dbName]);
163
+ try {
164
+ (0, child_process_1.execFileSync)('psql', ['-X', '-v', 'ON_ERROR_STOP=1', '-f', file, dbName], {
165
+ stdio: 'pipe',
166
+ env: { ...process.env, ...this.getEnv() }
167
+ });
168
+ }
169
+ catch (err) {
170
+ const detail = String(err.stderr ?? '').trim() || err.message;
171
+ throw new Error(`SQL file ${file} failed: ${detail}`, { cause: err });
172
+ }
164
173
  }
165
174
  async streamSql(sql, dbName) {
166
175
  await (0, stream_1.streamSql)({
package/esm/admin.js CHANGED
@@ -157,7 +157,16 @@ export class DbAdmin {
157
157
  if (!existsSync(file)) {
158
158
  throw new Error(`Missing SQL file: ${file}`);
159
159
  }
160
- this.run('psql', ['-f', file, dbName]);
160
+ try {
161
+ execFileSync('psql', ['-X', '-v', 'ON_ERROR_STOP=1', '-f', file, dbName], {
162
+ stdio: 'pipe',
163
+ env: { ...process.env, ...this.getEnv() }
164
+ });
165
+ }
166
+ catch (err) {
167
+ const detail = String(err.stderr ?? '').trim() || err.message;
168
+ throw new Error(`SQL file ${file} failed: ${detail}`, { cause: err });
169
+ }
161
170
  }
162
171
  async streamSql(sql, dbName) {
163
172
  await stream({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgsql-client",
3
- "version": "4.17.0",
3
+ "version": "4.18.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "PostgreSQL client utilities with query helpers, RLS context management, and database administration",
6
6
  "main": "index.js",
@@ -45,11 +45,11 @@
45
45
  "makage": "^0.8.0"
46
46
  },
47
47
  "dependencies": {
48
- "@pgpmjs/core": "^7.34.0",
48
+ "@pgpmjs/core": "^7.35.0",
49
49
  "@pgpmjs/logger": "^2.27.0",
50
50
  "@pgpmjs/types": "^2.58.0",
51
51
  "pg": "^8.21.0",
52
52
  "pg-env": "^1.33.0"
53
53
  },
54
- "gitHead": "487c4ec9ee997d7da80584a3d41d7120d4354c54"
54
+ "gitHead": "55dbe288f7f011fa6987f7f99bb9fc8d7183152b"
55
55
  }