Merge branch 'fix/pg-schema-with-inherit'

This commit is contained in:
Chareice 2023-02-16 15:01:50 +08:00
commit 2f8954b70f

View File

@ -9,7 +9,12 @@ export interface registerAppOptions extends Transactionable {
} }
export class ApplicationModel extends Model { export class ApplicationModel extends Model {
static async handleAppStart(app: Application, options: registerAppOptions) { static async handleAppStart(mainApp: Application, app: Application, options: registerAppOptions) {
await mainApp.emit('beforeSubAppLoad', {
mainApp,
subApp: app,
});
await app.load(); await app.load();
if (!(await app.isInstalled())) { if (!(await app.isInstalled())) {
@ -35,6 +40,7 @@ export class ApplicationModel extends Model {
const app = mainApp.appManager.createApplication(appName, { const app = mainApp.appManager.createApplication(appName, {
...options.appOptionsFactory(appName, mainApp), ...options.appOptionsFactory(appName, mainApp),
...appOptions, ...appOptions,
name: appName,
}); });
const isInstalled = await (async () => { const isInstalled = await (async () => {
@ -52,7 +58,7 @@ export class ApplicationModel extends Model {
await options.dbCreator(app); await options.dbCreator(app);
} }
await AppModel.handleAppStart(app, options); await AppModel.handleAppStart(mainApp, app, options);
await AppModel.update( await AppModel.update(
{ {