1177320
import { Application } from 'egg'
//import 'egg-sequelize'
export default (app: Application) => {
// @ts-ignore
const { STRING, UUID, UUIDV4, INTEGER, DECIMAL } = app.Sequelize;
// @ts-ignore
const model = app.model.define('bak', {
id: {
type: UUID,
defauleValue: UUIDV4,
primaryKey: true,
},
}, {
comment: '备份表',
});
return model;
};
其实本质上只想加载 sequelize 后,就可以正常使用 app.model 和 app.sequelize 了, 但是不知道为什么一直报错。
错误现象:
sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/sequelize/lib/sequelize.js:242:13
Error: [egg-core] load file: /showcase/app/model/bak.ts, error: Cannot find module 'egg-sequelize'