Comparing version 0.95.7 to 0.95.8
@@ -65,2 +65,3 @@ // MSSQL Client | ||
appName: settings.options.appName || 'knex', | ||
trustServerCertificate: false, | ||
...settings.options, | ||
@@ -67,0 +68,0 @@ }, |
@@ -247,8 +247,16 @@ // MSSQL Query Compiler | ||
const wheres = this.where(); | ||
const joins = this.join(); | ||
const { returning } = this.single; | ||
const returningStr = returning | ||
? ` ${this._returning('del', returning, true)}` | ||
: ''; | ||
const deleteSelector = joins ? `${tableName}${returningStr} ` : ''; | ||
return { | ||
sql: | ||
withSQL + | ||
`${this._buildTempTable(returning)}delete from ${tableName}` + | ||
(returning ? ` ${this._returning('del', returning, true)}` : '') + | ||
`${this._buildTempTable( | ||
returning | ||
)}delete ${deleteSelector}from ${tableName}` + | ||
(!joins ? returningStr : '') + | ||
(joins ? ` ${joins}` : '') + | ||
(wheres ? ` ${wheres}` : '') + | ||
@@ -267,8 +275,15 @@ (!returning | ||
const wheres = this.where(); | ||
const joins = this.join(); | ||
const { returning } = this.single; | ||
const returningStr = returning | ||
? ` ${this._returning('del', returning)}` | ||
: ''; | ||
// returning needs to be before "from" when using join | ||
const deleteSelector = joins ? `${tableName}${returningStr} ` : ''; | ||
return { | ||
sql: | ||
withSQL + | ||
`delete from ${tableName}` + | ||
(returning ? ` ${this._returning('del', returning)}` : '') + | ||
`delete ${deleteSelector}from ${tableName}` + | ||
(!joins ? returningStr : '') + | ||
(joins ? ` ${joins}` : '') + | ||
(wheres ? ` ${wheres}` : '') + | ||
@@ -275,0 +290,0 @@ (!returning ? this._returning('rowcount', '@@rowcount') : ''), |
@@ -7,2 +7,3 @@ /* eslint max-len:0 */ | ||
const Trigger = require('./internal/trigger'); | ||
const { isObject } = require('../../../util/is'); | ||
@@ -91,2 +92,7 @@ // Table Compiler | ||
primary(columns, constraintName) { | ||
let deferrable; | ||
if (isObject(constraintName)) { | ||
({ constraintName, deferrable } = constraintName); | ||
} | ||
deferrable = deferrable ? ` deferrable initially ${deferrable}` : ''; | ||
constraintName = constraintName | ||
@@ -98,3 +104,3 @@ ? this.formatter.wrap(constraintName) | ||
columns | ||
)})` | ||
)})${deferrable}` | ||
); | ||
@@ -132,2 +138,7 @@ } | ||
unique(columns, indexName) { | ||
let deferrable; | ||
if (isObject(indexName)) { | ||
({ indexName, deferrable } = indexName); | ||
} | ||
deferrable = deferrable ? ` deferrable initially ${deferrable}` : ''; | ||
indexName = indexName | ||
@@ -140,3 +151,4 @@ ? this.formatter.wrap(indexName) | ||
this.formatter.columnize(columns) + | ||
')' | ||
')' + | ||
deferrable | ||
); | ||
@@ -143,0 +155,0 @@ } |
@@ -46,2 +46,4 @@ function generateCombinedName(logger, postfix, name, subNames) { | ||
return [ | ||
'DPI-1010', // not connected | ||
'DPI-1080', // connection was closed by ORA-%d | ||
'ORA-03114', // not connected to ORACLE | ||
@@ -74,3 +76,2 @@ 'ORA-03113', // end-of-file on communication channel | ||
'ORA-56600', // an illegal OCI function call was issued | ||
'NJS-040', | ||
'NJS-024', | ||
@@ -77,0 +78,0 @@ 'NJS-003', |
@@ -74,6 +74,6 @@ // PostgreSQL Column Compiler | ||
} | ||
useTz = typeof useTz === 'boolean' ? useTz : true; | ||
precision = precision ? '(' + precision + ')' : ''; | ||
return `${useTz ? 'timestamptz' : 'timestamp'}${ | ||
precision ? '(' + precision + ')' : '' | ||
}`; | ||
return `${useTz ? 'timestamptz' : 'timestamp'}${precision}`; | ||
} | ||
@@ -88,6 +88,6 @@ | ||
} | ||
useTz = typeof useTz === 'boolean' ? useTz : true; | ||
precision = precision ? '(' + precision + ')' : ''; | ||
return `${useTz ? 'timestamptz' : 'timestamp'}${ | ||
precision ? '(' + precision + ')' : '' | ||
}`; | ||
return `${useTz ? 'timestamptz' : 'timestamp'}${precision}`; | ||
} | ||
@@ -94,0 +94,0 @@ |
@@ -8,2 +8,3 @@ /* eslint max-len: 0 */ | ||
const TableCompiler = require('../../../schema/tablecompiler'); | ||
const { isObject } = require('../../../util/is'); | ||
@@ -116,2 +117,7 @@ class TableCompiler_PG extends TableCompiler { | ||
primary(columns, constraintName) { | ||
let deferrable; | ||
if (isObject(constraintName)) { | ||
({ constraintName, deferrable } = constraintName); | ||
} | ||
deferrable = deferrable ? ` deferrable initially ${deferrable}` : ''; | ||
constraintName = constraintName | ||
@@ -123,3 +129,3 @@ ? this.formatter.wrap(constraintName) | ||
columns | ||
)})` | ||
)})${deferrable}` | ||
); | ||
@@ -129,2 +135,7 @@ } | ||
unique(columns, indexName) { | ||
let deferrable; | ||
if (isObject(indexName)) { | ||
({ indexName, deferrable } = indexName); | ||
} | ||
deferrable = deferrable ? ` deferrable initially ${deferrable}` : ''; | ||
indexName = indexName | ||
@@ -137,3 +148,4 @@ ? this.formatter.wrap(indexName) | ||
this.formatter.columnize(columns) + | ||
')' | ||
')' + | ||
deferrable | ||
); | ||
@@ -140,0 +152,0 @@ } |
@@ -733,5 +733,11 @@ // Query Compiler | ||
const wheres = this.where(); | ||
const joins = this.join(); | ||
// When using joins, delete the "from" table values as a default | ||
const deleteSelector = joins ? tableName + ' ' : ''; | ||
return ( | ||
withSQL + | ||
`delete from ${this.single.only ? 'only ' : ''}${tableName}` + | ||
`delete ${deleteSelector}from ${ | ||
this.single.only ? 'only ' : '' | ||
}${tableName}` + | ||
(joins ? ` ${joins}` : '') + | ||
(wheres ? ` ${wheres}` : '') | ||
@@ -738,0 +744,0 @@ ); |
@@ -119,2 +119,16 @@ // TableBuilder | ||
}, | ||
deferrable: (type) => { | ||
const unSupported = [ | ||
'mysql', | ||
'mssql', | ||
'redshift', | ||
'mysql2', | ||
'oracledb', | ||
]; | ||
if (unSupported.indexOf(this.client.dialect) !== -1) { | ||
throw new Error(`${this.client.dialect} does not support deferrable`); | ||
} | ||
foreignData.deferrable = type; | ||
return returnObj; | ||
}, | ||
_columnBuilder(builder) { | ||
@@ -121,0 +135,0 @@ extend(builder, returnObj); |
@@ -100,2 +100,7 @@ /* eslint max-len:0 */ | ||
: ''; | ||
const deferrable = foreignData.deferrable | ||
? this.lowerCase | ||
? ` deferrable initially ${foreignData.deferrable.toLowerCase()} ` | ||
: ` DEFERRABLE INITIALLY ${foreignData.deferrable.toUpperCase()} ` | ||
: ''; | ||
if (this.lowerCase) { | ||
@@ -114,2 +119,3 @@ this.pushQuery( | ||
')' + | ||
deferrable + | ||
onUpdate + | ||
@@ -131,2 +137,3 @@ onDelete | ||
')' + | ||
deferrable + | ||
onUpdate + | ||
@@ -133,0 +140,0 @@ onDelete |
{ | ||
"name": "knex", | ||
"version": "0.95.7", | ||
"version": "0.95.8", | ||
"description": "A batteries-included SQL query & schema builder for Postgres, MySQL and SQLite3 and the Browser", | ||
@@ -54,3 +54,3 @@ "main": "knex", | ||
"pg-connection-string": "2.5.0", | ||
"rechoir": "^0.7.0", | ||
"rechoir": "0.7.0", | ||
"resolve-from": "^5.0.0", | ||
@@ -84,3 +84,3 @@ "tarn": "^3.0.1", | ||
"devDependencies": { | ||
"@types/node": "^16.3.1", | ||
"@types/node": "^16.4.2", | ||
"chai": "^4.3.4", | ||
@@ -93,3 +93,3 @@ "chai-as-promised": "^7.1.1", | ||
"dtslint": "4.1.2", | ||
"eslint": "^7.30.0", | ||
"eslint": "^7.31.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
@@ -100,4 +100,4 @@ "eslint-plugin-import": "^2.23.4", | ||
"JSONStream": "^1.3.5", | ||
"lint-staged": "^11.0.0", | ||
"mocha": "^9.0.2", | ||
"lint-staged": "^11.1.1", | ||
"mocha": "^9.0.3", | ||
"mock-fs": "^4.13.0", | ||
@@ -107,3 +107,3 @@ "mysql": "^2.18.1", | ||
"nyc": "^15.1.0", | ||
"oracledb": "^5.1.0", | ||
"oracledb": "^5.2.0", | ||
"pg": "^8.6.0", | ||
@@ -119,3 +119,3 @@ "pg-query-stream": "^4.1.0", | ||
"tape": "^5.2.2", | ||
"tedious": "^11.0.9", | ||
"tedious": "^11.4.0", | ||
"toxiproxy-node-client": "^2.0.6", | ||
@@ -122,0 +122,0 @@ "ts-node": "^10.1.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
719593
19027
+ Addedrechoir@0.7.0(transitive)
- Removedrechoir@0.7.1(transitive)
Updatedrechoir@0.7.0