fix(database): refactor getConnection to not use schemas

This commit is contained in:
Jamie Howard 2022-11-15 13:28:35 +00:00
parent cad6a8da1c
commit 0f7eb70fd2
2 changed files with 3 additions and 6 deletions

View File

@ -243,9 +243,8 @@ const cleanOrderColumns = async ({ id, attribute, db, inverseRelIds, transaction
.transacting(trx);
break;
default: {
const dbConnection =
strapi.db.dialect.client === 'postgres' ? db.connection : db.getConnection();
await dbConnection
await db
.getConnection()
.raw(
`UPDATE ?? as a
SET ${update.join(', ')}

View File

@ -48,9 +48,7 @@ class Database {
}
getConnection(tableName) {
const schema = this.connection.getSchemaName();
const connection = tableName ? this.connection(tableName) : this.connection;
return schema ? connection.withSchema(schema) : connection;
return tableName ? this.connection(tableName) : this.connection;
}
getSchemaConnection(trx = this.connection) {