@contember/database
Advanced tools
Comparing version 1.0.0-rc.0 to 1.0.0-rc.1
@@ -27,2 +27,5 @@ "use strict"; | ||
const constraints = await this.formatConstraints(); | ||
if (constraints === null) { | ||
return; | ||
} | ||
await this.client.query(`SET CONSTRAINTS ${constraints} ${policy}`); | ||
@@ -37,2 +40,5 @@ } | ||
} | ||
if (this.fkConstraintNames.length === 0) { | ||
return null; | ||
} | ||
return this.fkConstraintNames.map(it => `${(0, sql_1.wrapIdentifier)(this.client.schema)}.${(0, sql_1.wrapIdentifier)(it)}`).join(', '); | ||
@@ -39,0 +45,0 @@ } |
{ | ||
"name": "@contember/database", | ||
"version": "1.0.0-rc.0", | ||
"version": "1.0.0-rc.1", | ||
"license": "Apache-2.0", | ||
@@ -11,6 +11,6 @@ "main": "dist/src/index.js", | ||
"dependencies": { | ||
"@contember/queryable": "^1.0.0-rc.0" | ||
"@contember/queryable": "^1.0.0-rc.1" | ||
}, | ||
"devDependencies": { | ||
"@contember/database-tester": "^1.0.0-rc.0", | ||
"@contember/database-tester": "^1.0.0-rc.1", | ||
"@types/node": "^17.0.5", | ||
@@ -17,0 +17,0 @@ "pg": "^8.5.0", |
@@ -28,6 +28,9 @@ import { Client } from '../client' | ||
const constraints = await this.formatConstraints() | ||
if (constraints === null) { | ||
return | ||
} | ||
await this.client.query(`SET CONSTRAINTS ${constraints} ${policy}`) | ||
} | ||
private async formatConstraints(): Promise<string> { | ||
private async formatConstraints(): Promise<string | null> { | ||
if (this.fkConstraintNames === null) { | ||
@@ -44,4 +47,7 @@ this.fkConstraintNames = ( | ||
} | ||
if (this.fkConstraintNames.length === 0) { | ||
return null | ||
} | ||
return this.fkConstraintNames.map(it => `${wrapIdentifier(this.client.schema)}.${wrapIdentifier(it)}`).join(', ') | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
444594
6254