mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
revert(server): revert create database api
This commit is contained in:
parent
d486d13d39
commit
510767eb9f
@ -1294,7 +1294,7 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
|
|||||||
protected createMainDataSource(options: ApplicationOptions) {
|
protected createMainDataSource(options: ApplicationOptions) {
|
||||||
const mainDataSourceInstance = new MainDataSource({
|
const mainDataSourceInstance = new MainDataSource({
|
||||||
name: 'main',
|
name: 'main',
|
||||||
database: this.createDatabase(options.database),
|
database: this.createDatabase(options),
|
||||||
acl: createACL(),
|
acl: createACL(),
|
||||||
resourceManager: createResourcer(options),
|
resourceManager: createResourcer(options),
|
||||||
useACL: options.acl,
|
useACL: options.acl,
|
||||||
@ -1309,7 +1309,7 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
|
|||||||
this.dataSourceManager.dataSources.set('main', mainDataSourceInstance);
|
this.dataSourceManager.dataSources.set('main', mainDataSourceInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected createDatabase(options: IDatabaseOptions | Database): Database {
|
protected createDatabase(options: ApplicationOptions) {
|
||||||
const logging = (...args) => {
|
const logging = (...args) => {
|
||||||
let msg = args[0];
|
let msg = args[0];
|
||||||
|
|
||||||
@ -1330,7 +1330,7 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
|
|||||||
this._sqlLogger.debug(content);
|
this._sqlLogger.debug(content);
|
||||||
};
|
};
|
||||||
|
|
||||||
const dbOptions = options instanceof Database ? options.options : options;
|
const dbOptions = options.database instanceof Database ? options.database.options : options.database;
|
||||||
const db = new Database({
|
const db = new Database({
|
||||||
...dbOptions,
|
...dbOptions,
|
||||||
logging: dbOptions.logging ? logging : false,
|
logging: dbOptions.logging ? logging : false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user