Closed nodejh closed 4 years ago
//@ts-nocheck import { IApplicationContext, providerWrapper } from "midway"; import { DataTypes, Sequelize } from 'sequelize'; import { IDB } from './db'; export default async function setupModel(context: IApplicationContext) { const db: IDB = await context.getAsync('DB'); const attributes = { id: { type: DataTypes.BIGINT.UNSIGNED, allowNull: false, defaultValue: null, primaryKey: true, autoIncrement: true, comment: "主键", field: "id" }, gmtCreate: { type: DataTypes.DATE, allowNull: false, defaultValue: sequelize.literal('CURRENT_TIMESTAMP'), primaryKey: false, autoIncrement: false, comment: "创建时间", field: "gmt_create" }, gmtModified: { type: DataTypes.DATE, allowNull: false, defaultValue: sequelize.literal('CURRENT_TIMESTAMP'), primaryKey: false, autoIncrement: false, comment: "修改时间", field: "gmt_modified" }, return db.sequelize.define("test", attributes, options); } providerWrapper([{ id: "TestModel", provider: setupModel }]);
type is egg or midway: ReferenceError: sequelize is not defined.
type is egg or midway: ReferenceError: sequelize is not defined.