@sqlanvil/cli 1.4.0 → 1.4.1
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/bundle.js +25 -20
- package/package.json +1 -1
package/bundle.js
CHANGED
|
@@ -38424,9 +38424,16 @@ class PostgresExecutionSql {
|
|
|
38424
38424
|
? ` include (${index.include.map(c => `"${c}"`).join(", ")})`
|
|
38425
38425
|
: "";
|
|
38426
38426
|
const where = index.where ? ` where (${index.where})` : "";
|
|
38427
|
-
|
|
38427
|
+
const indexName = index.name || this.defaultIndexName(table.target.name, index.columns, !!index.unique);
|
|
38428
|
+
return `create ${unique}index "${indexName}" on ${target} using ${method} (${columns})${include}${where}`;
|
|
38428
38429
|
});
|
|
38429
38430
|
}
|
|
38431
|
+
defaultIndexName(tableName, columns, unique) {
|
|
38432
|
+
const parts = [tableName, ...(columns || [])].filter(Boolean);
|
|
38433
|
+
const base = parts.join("_");
|
|
38434
|
+
const suffix = unique ? "_key" : "_idx";
|
|
38435
|
+
return `${base}${suffix}`.slice(0, 63);
|
|
38436
|
+
}
|
|
38430
38437
|
indexMethodAsSql(method) {
|
|
38431
38438
|
switch (method) {
|
|
38432
38439
|
case sqlanvil.PostgresOptions.Index.Method.HASH:
|
|
@@ -38653,7 +38660,7 @@ function collectEvaluationQueries(queryOrAction, concatenate, queryModifier = (q
|
|
|
38653
38660
|
.filter(validationQuery => !!validationQuery.query);
|
|
38654
38661
|
}
|
|
38655
38662
|
|
|
38656
|
-
const version = "1.4.
|
|
38663
|
+
const version = "1.4.1";
|
|
38657
38664
|
const dataformVersion = "3.0.59";
|
|
38658
38665
|
|
|
38659
38666
|
async function build(compiledGraph, runConfig, dbadapter) {
|
|
@@ -40347,15 +40354,23 @@ class PgPoolExecutor {
|
|
|
40347
40354
|
}
|
|
40348
40355
|
async withClientLock(callback) {
|
|
40349
40356
|
const client = await this.pool.connect();
|
|
40357
|
+
let released = false;
|
|
40358
|
+
const releaseOnce = (err) => {
|
|
40359
|
+
if (released) {
|
|
40360
|
+
return;
|
|
40361
|
+
}
|
|
40362
|
+
released = true;
|
|
40363
|
+
try {
|
|
40364
|
+
client.release(err);
|
|
40365
|
+
}
|
|
40366
|
+
catch (e) {
|
|
40367
|
+
console.error("Error thrown when releasing pg.Client", e.message, e.stack);
|
|
40368
|
+
}
|
|
40369
|
+
};
|
|
40350
40370
|
try {
|
|
40351
40371
|
client.on("error", err => {
|
|
40352
40372
|
console.error("pg.Client client error", err.message, err.stack);
|
|
40353
|
-
|
|
40354
|
-
client.release(err);
|
|
40355
|
-
}
|
|
40356
|
-
catch (e) {
|
|
40357
|
-
console.error("Error thrown when releasing errored pg.Client", e.message, e.stack);
|
|
40358
|
-
}
|
|
40373
|
+
releaseOnce(err);
|
|
40359
40374
|
});
|
|
40360
40375
|
return await callback({
|
|
40361
40376
|
execute: async (statement, options = { rowLimit: 1000, byteLimit: 1024 * 1024 }) => {
|
|
@@ -40380,12 +40395,7 @@ class PgPoolExecutor {
|
|
|
40380
40395
|
}
|
|
40381
40396
|
});
|
|
40382
40397
|
query.on("error", err => {
|
|
40383
|
-
|
|
40384
|
-
client.release(err);
|
|
40385
|
-
}
|
|
40386
|
-
catch (e) {
|
|
40387
|
-
console.error("Error thrown when releasing errored pg.Query", e.message, e.stack);
|
|
40388
|
-
}
|
|
40398
|
+
releaseOnce(err);
|
|
40389
40399
|
reject(err);
|
|
40390
40400
|
});
|
|
40391
40401
|
query.on("end", () => {
|
|
@@ -40396,12 +40406,7 @@ class PgPoolExecutor {
|
|
|
40396
40406
|
});
|
|
40397
40407
|
}
|
|
40398
40408
|
finally {
|
|
40399
|
-
|
|
40400
|
-
client.release();
|
|
40401
|
-
}
|
|
40402
|
-
catch (e) {
|
|
40403
|
-
console.error("Error thrown when releasing ended pg.Client", e.message, e.stack);
|
|
40404
|
-
}
|
|
40409
|
+
releaseOnce();
|
|
40405
40410
|
}
|
|
40406
40411
|
}
|
|
40407
40412
|
async close() {
|