mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 01:39:52 +08:00
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import Logger from './logger';
|
|
import { EnvModel } from '../data/env';
|
|
import { CrontabModel } from '../data/cron';
|
|
import { DependenceModel } from '../data/dependence';
|
|
import { AppModel } from '../data/open';
|
|
import { SystemModel } from '../data/system';
|
|
import { SubscriptionModel } from '../data/subscription';
|
|
import { CrontabViewModel } from '../data/cronView';
|
|
import { CrontabStatModel } from '../data/cronStats';
|
|
import { RunningInstanceModel } from '../data/runningInstance';
|
|
import { sequelize } from '../data';
|
|
import { UserModel } from '../data/user';
|
|
import { migrateUserSchema } from '../shared/userSchemaMigrations';
|
|
import { migrateSchema } from '../shared/schemaMigrations';
|
|
|
|
export default async () => {
|
|
try {
|
|
await CrontabModel.sync();
|
|
await DependenceModel.sync();
|
|
await AppModel.sync();
|
|
await SystemModel.sync();
|
|
await EnvModel.sync();
|
|
await SubscriptionModel.sync();
|
|
await CrontabViewModel.sync();
|
|
await CrontabStatModel.sync();
|
|
await RunningInstanceModel.sync();
|
|
|
|
await UserModel.sync();
|
|
await migrateSchema(sequelize);
|
|
await migrateUserSchema(sequelize);
|
|
|
|
Logger.info('[boot] DB loaded');
|
|
} catch (error) {
|
|
Logger.error('[boot] DB load failed', error);
|
|
throw error;
|
|
}
|
|
};
|