diff --git a/src/metadata/EntityMetadata.ts b/src/metadata/EntityMetadata.ts index 7335a45b4f..0d297fee00 100644 --- a/src/metadata/EntityMetadata.ts +++ b/src/metadata/EntityMetadata.ts @@ -839,8 +839,10 @@ export class EntityMetadata { */ protected buildTablePath(): string { let tablePath = this.tableName; - if (this.schema) + if (this.schema && ((this.connection.driver instanceof PostgresDriver) || (this.connection.driver instanceof SqlServerDriver))) { tablePath = this.schema + "." + tablePath; + } + if (this.database && !(this.connection.driver instanceof PostgresDriver)) { if (!this.schema && this.connection.driver instanceof SqlServerDriver) { tablePath = this.database + ".." + tablePath;