knex-schema-inspector
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -117,10 +117,14 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var count; | ||
var result; | ||
return __generator(this, function (_a) { | ||
count = this.knex | ||
.count({ count: '*' }) | ||
.from('information_schema.tables') | ||
.where({ table_schema: this.knex.client.database(), table_name: table }) | ||
.first().count; | ||
return [2 /*return*/, !!count]; | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.knex | ||
.count({ count: '*' }) | ||
.from('information_schema.tables') | ||
.where({ table_schema: this.knex.client.database(), table_name: table }) | ||
.first()]; | ||
case 1: | ||
result = _a.sent(); | ||
return [2 /*return*/, (result && result.count === 1) || false]; | ||
} | ||
}); | ||
@@ -127,0 +131,0 @@ }); |
@@ -112,3 +112,3 @@ import Knex from 'knex'; | ||
async hasTable(table: string): Promise<boolean> { | ||
const { count } = this.knex | ||
const result = await this.knex | ||
.count<{ count: 0 | 1 }>({ count: '*' }) | ||
@@ -118,3 +118,3 @@ .from('information_schema.tables') | ||
.first(); | ||
return !!count; | ||
return (result && result.count === 1) || false; | ||
} | ||
@@ -121,0 +121,0 @@ |
{ | ||
"name": "knex-schema-inspector", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "[WIP] Utility for extracting information about existing DB schema", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
86252
1894