我正在yarn sequelize db:migrate使用 docker 中的 postgres 图像在数据库中创建表,并返回以下消息:mateus @ fariasmateuss: ~ / Projects / gobarber / server $ yarn sequelize db: migrateyarn run v1.22.4$ /home/mateus/Projects/gobarber/server/node_modules/.bin/sequelize db: migrateSequelize CLI [Node: 12.17.0, CLI: 6.0.0, ORM: 6.2.0]Loaded configuration file "src / config / database.js".== 20200627041347-create-users: migrating =======ERROR: Cannot read property 'type' of undefinederror Command failed with exit code 1.info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command文件配置.sequelizerc:const {resolve} = require ('path');module.exports = { config: resolves (__ dirname, 'src', 'config', 'database.js'), 'models-path': resolves (__ dirname, 'src', 'app', 'models'), 'migrations-path': resolves (__ dirname, 'src', 'database', 'migrations'), 'seeders-path': resolves (__ dirname, 'src', 'database', 'seeds'),};在文件中创建表的代码migrations.js:module.exports = { up: (queryInterface, Sequelize) => { return queryInterface.createTable ('users', { id: { type: Sequelize.INTEGER, allowNull: false, autoIncrement: true, primaryKey: true, }, name: { type: Sequelize.STRING, allowNull: false, }, email: { type: Sequelize.STRING, allowNull: false, unique: true, }, password_hash: { type: Sequelize.STRING, allowNull: false, }, provider: { type: Sequelize.BOOLEAN, defaultValues: false, allowNull: false, }, created_at: { type: Sequelize.DATA, allowNull: false, }, updated_at: { type: Sequelize.DATA, allowNull: false, }, }); }, down: (queryInterface) => { return queryInterface.dropTable ('users'); },};操作系统:Linux Focal Fossa 20.04 LTS有谁知道可能的解决方案是什么?
1 回答

湖上湖
TA贡献2003条经验 获得超2个赞
错误似乎是一个错字,type
for Sequelize.DATA
vs Sequelize.DATE
.
以下是有效的数据类型。
https://sequelize.org/v5/manual/data-types.html
添加回答
举报
0/150
提交
取消