fix: organization build db connection error

This commit is contained in:
Ahmed Bouhuolia
2025-10-25 14:57:38 +02:00
parent 8852a4a0f8
commit 2b4772a070
2 changed files with 9 additions and 7 deletions

View File

@@ -23,7 +23,7 @@ export class TenantDBManager {
@Inject(SystemKnexConnection)
private readonly systemKnex: Knex,
) {}
) { }
/**
* Retrieves the tenant database name.
@@ -45,8 +45,8 @@ export class TenantDBManager {
const results = await this.systemKnex.raw(
'SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = "' +
databaseName +
'"',
databaseName +
'"',
);
return results[0].length > 0;
}
@@ -73,12 +73,12 @@ export class TenantDBManager {
*/
public async dropDatabaseIfExists() {
const tenant = await this.tenancyContext.getTenant();
const isExists = await this.databaseExists(tenant);
const isExists = await this.databaseExists();
if (!isExists) {
return;
}
await this.dropDatabase(tenant);
await this.dropDatabase();
}
/**
@@ -115,7 +115,7 @@ export class TenantDBManager {
* @return {Promise<void>}
*/
async throwErrorIfTenantDBExists(tenant: TenantModel) {
const isExists = await this.databaseExists(tenant);
const isExists = await this.databaseExists();
if (isExists) {
throw new TenantDBAlreadyExists();
}