parent
b4641eb0d5
commit
43e52843fa
@ -5,7 +5,7 @@ export default class DatabaseUtils {
|
||||
constructor(public db: Database) {}
|
||||
|
||||
addSchema(tableName, schema?) {
|
||||
if (this.db.options.schema) {
|
||||
if (this.db.options.schema && !schema) {
|
||||
schema = this.db.options.schema;
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ export default class DatabaseUtils {
|
||||
// @ts-ignore
|
||||
tableName = this.db.sequelize.getQueryInterface().queryGenerator.addSchema({
|
||||
tableName,
|
||||
_schema: this.db.options.schema,
|
||||
_schema: schema,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
Sequelize,
|
||||
SyncOptions,
|
||||
Transactionable,
|
||||
Utils
|
||||
Utils,
|
||||
} from 'sequelize';
|
||||
import { SequelizeStorage, Umzug } from 'umzug';
|
||||
import { Collection, CollectionOptions, RepositoryType } from './collection';
|
||||
@ -58,7 +58,7 @@ import {
|
||||
SyncListener,
|
||||
UpdateListener,
|
||||
UpdateWithAssociationsListener,
|
||||
ValidateListener
|
||||
ValidateListener,
|
||||
} from './types';
|
||||
import { patchSequelizeQueryInterface, snakeCase } from './utils';
|
||||
|
||||
@ -174,6 +174,7 @@ export class Database extends EventEmitter implements AsyncEmitter {
|
||||
|
||||
constructor(options: DatabaseOptions) {
|
||||
super();
|
||||
|
||||
this.version = new DatabaseVersion(this);
|
||||
|
||||
const opts = {
|
||||
|
@ -52,10 +52,11 @@ export class AppManager extends EventEmitter {
|
||||
return server.listen(...args);
|
||||
}
|
||||
|
||||
async getApplication(appName: string): Promise<null | Application> {
|
||||
async getApplication(appName: string, options = {}): Promise<null | Application> {
|
||||
await this.emitAsync('beforeGetApplication', {
|
||||
appManager: this,
|
||||
name: appName,
|
||||
options,
|
||||
});
|
||||
|
||||
return this.applications.get(appName);
|
||||
|
@ -14,7 +14,7 @@ import {
|
||||
beforeCreateForChildrenCollection,
|
||||
beforeCreateForReverseField,
|
||||
beforeDestroyForeignKey,
|
||||
beforeInitOptions
|
||||
beforeInitOptions,
|
||||
} from './hooks';
|
||||
|
||||
import { InheritedCollection } from '@nocobase/database';
|
||||
|
Loading…
Reference in New Issue
Block a user