fix: hotbugs in multi-tenant arch.

This commit is contained in:
Ahmed Bouhuolia
2020-04-22 01:12:24 +02:00
parent 8f588ffc51
commit 1e13aa16ac
6 changed files with 33 additions and 80 deletions

View File

@@ -1,4 +1,5 @@
import Knex from 'knex';
import { knexSnakeCaseMappers } from 'objection';
import Tenant from '@/system/models/Tenant';
import config from '@/../config/config';
@@ -50,7 +51,10 @@ export default class TenantsManager {
let knex = knexCache.get(organizationId);
if (!knex) {
knex = Knex(this.getTenantKnexConfig(organizationId));
knex = Knex({
...this.getTenantKnexConfig(organizationId),
...knexSnakeCaseMappers({ upperCase: true }),
});
knexCache.set(organizationId, knex);
}
return knex;