diff --git a/src/data-source/DataSource.ts b/src/data-source/DataSource.ts index 2775422322..8f218098a3 100644 --- a/src/data-source/DataSource.ts +++ b/src/data-source/DataSource.ts @@ -234,9 +234,6 @@ export class DataSource { // connect to the cache-specific database if cache is enabled if (this.queryResultCache) await this.queryResultCache.connect() - // set connected status for the current connection - ObjectUtils.assign(this, { isInitialized: true }) - try { // build all metadatas registered in the current connection await this.buildMetadatas() @@ -261,6 +258,9 @@ export class DataSource { throw error } + // set connected status for the current connection + ObjectUtils.assign(this, { isInitialized: true }) + return this }