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