Comparing version 10.0.0-beta13 to 10.0.0-beta14
{ | ||
"name": "pg-boss", | ||
"version": "10.0.0-beta13", | ||
"version": "10.0.0-beta14", | ||
"description": "Queueing jobs in Postgres from Node.js like a boss", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -63,2 +63,10 @@ const assert = require('assert') | ||
this.getQueuesForEventCommand = plans.getQueuesForEvent(config.schema) | ||
this.getQueueByNameCommand = plans.getQueueByName(config.schema) | ||
this.deleteQueueRecordsCommand = plans.deleteQueueRecords(config.schema) | ||
this.insertQueueCommand = plans.insertQueue(config.schema) | ||
this.updateQueueCommand = plans.updateQueue(config.schema) | ||
this.createPartitionCommand = plans.createPartition(config.schema) | ||
this.dropPartitionCommand = plans.dropPartition(config.schema) | ||
this.clearStorageCommand = plans.clearStorage(config.schema) | ||
this.purgeQueueCommand = plans.purgeQueue(config.schema) | ||
@@ -568,8 +576,4 @@ // exported api to index | ||
const paritionSql = plans.createPartition(this.config.schema, name) | ||
await this.db.executeSql(this.createPartitionCommand, [name]) | ||
await this.db.executeSql(paritionSql) | ||
const sql = plans.insertQueue(this.config.schema) | ||
const params = [ | ||
@@ -586,3 +590,3 @@ name, | ||
await this.db.executeSql(sql, params) | ||
await this.db.executeSql(this.insertQueueCommand, params) | ||
} | ||
@@ -611,4 +615,2 @@ | ||
const sql = plans.updateQueue(this.config.schema) | ||
const params = [ | ||
@@ -625,3 +627,3 @@ name, | ||
await this.db.executeSql(sql, params) | ||
await this.db.executeSql(this.updateQueueCommand, params) | ||
} | ||
@@ -632,4 +634,3 @@ | ||
const sql = plans.getQueueByName(this.config.schema) | ||
const result = await this.db.executeSql(sql, [name]) | ||
const result = await this.db.executeSql(this.getQueueByNameCommand, [name]) | ||
@@ -665,8 +666,7 @@ if (result.rows.length === 0) { | ||
const queueSql = plans.getQueueByName(this.config.schema) | ||
const { rows } = await this.db.executeSql(queueSql, [name]) | ||
const { rows } = await this.db.executeSql(this.getQueueByNameCommand, [name]) | ||
if (rows.length) { | ||
await this.db.executeSql(plans.dropPartition(this.config.schema, name)) | ||
await this.db.executeSql(plans.deleteQueueRecords(this.config.schema), [name]) | ||
await this.db.executeSql(this.dropPartitionCommand, [name]) | ||
await this.db.executeSql(this.deleteQueueRecordsCommand, [name]) | ||
} | ||
@@ -677,9 +677,7 @@ } | ||
Attorney.assertQueueName(name) | ||
const sql = plans.purgeQueue(this.config.schema) | ||
await this.db.executeSql(sql, [name]) | ||
await this.db.executeSql(this.purgeQueueCommand, [name]) | ||
} | ||
async clearStorage () { | ||
const sql = plans.clearStorage(this.config.schema) | ||
await this.db.executeSql(sql) | ||
await this.db.executeSql(this.clearStorageCommand) | ||
} | ||
@@ -686,0 +684,0 @@ |
@@ -219,4 +219,4 @@ const DEFAULT_SCHEMA = 'pgboss' | ||
function createPartition (schema, name) { | ||
return `SELECT ${schema}.create_partition('${name}');` | ||
function createPartition (schema) { | ||
return `SELECT ${schema}.create_partition($1)` | ||
} | ||
@@ -279,4 +279,4 @@ | ||
function dropPartition (schema, name) { | ||
return `SELECT ${schema}.drop_partition('${name}');` | ||
function dropPartition (schema) { | ||
return `SELECT ${schema}.drop_partition($1)` | ||
} | ||
@@ -289,7 +289,7 @@ | ||
function createQueueForeignKeyJob (schema) { | ||
return `ALTER TABLE ${schema}.job ADD FOREIGN KEY (name) REFERENCES ${schema}.queue (name) ON DELETE RESTRICT` | ||
return `ALTER TABLE ${schema}.job ADD CONSTRAINT q_fkey FOREIGN KEY (name) REFERENCES ${schema}.queue (name) ON DELETE RESTRICT` | ||
} | ||
function createQueueForeignKeyJobDeadLetter (schema) { | ||
return `ALTER TABLE ${schema}.job ADD FOREIGN KEY (dead_letter) REFERENCES ${schema}.queue (name) ON DELETE RESTRICT` | ||
return `ALTER TABLE ${schema}.job ADD CONSTRAINT dlq_fkey FOREIGN KEY (dead_letter) REFERENCES ${schema}.queue (name) ON DELETE RESTRICT` | ||
} | ||
@@ -296,0 +296,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
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
98035
2638