mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
WIP Multi-tenant architecture.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import Knex from 'knex';
|
||||
import { knexSnakeCaseMappers } from 'objection';
|
||||
import knexfile from '@/../knexfile';
|
||||
import knexfile from '@/../config/systemKnexfile';
|
||||
|
||||
const config = knexfile[process.env.NODE_ENV];
|
||||
const knex = Knex({
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
import knexManager from 'knex-db-manager';
|
||||
import knexfile from '@/../knexfile';
|
||||
import knexfile from '@/../config/systemKnexfile';
|
||||
import config from '@/../config/config';
|
||||
|
||||
const config = knexfile[process.env.NODE_ENV];
|
||||
const knexConfig = knexfile[process.env.NODE_ENV];
|
||||
|
||||
console.log({
|
||||
superUser: config.manager.superUser,
|
||||
superPassword: config.manager.superPassword,
|
||||
});
|
||||
const dbManager = knexManager.databaseManagerFactory({
|
||||
knex: config,
|
||||
knex: knexConfig,
|
||||
dbManager: {
|
||||
// db manager related configuration
|
||||
collate: [],
|
||||
superUser: 'root',
|
||||
superPassword: 'root',
|
||||
// populatePathPattern: 'data/**/*.js', // glob format for searching seeds
|
||||
superUser: config.manager.superUser,
|
||||
superPassword: config.manager.superPassword,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -12,10 +12,6 @@ exports.up = function (knex) {
|
||||
table.string('language');
|
||||
table.date('last_login_at');
|
||||
table.timestamps();
|
||||
}).then(() => {
|
||||
knex.seed.run({
|
||||
specific: 'seed_users.js',
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
7
server/src/database/objection.js
Normal file
7
server/src/database/objection.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Model } from 'objection';
|
||||
import knex from '@/database/knex';
|
||||
|
||||
// Bind all Models to a knex instance. If you only have one database in
|
||||
// your server this is all you have to do. For multi database systems, see
|
||||
// the Model.bindKnex() method.
|
||||
Model.knex(knex);
|
||||
Reference in New Issue
Block a user