未处理的拒绝SequelizeUniqueConstraintError:Query.formatError上的验证错误

时间:2019-12-14 19:44:39

标签: mysql node.js express sequelize.js

Unhandled rejection SequelizeUniqueConstraintError: Validation error at Query.formatError 

(D:\TabTracker\server\node_modules\sequelize\lib\dialects\mysql\query.js:223:16)
    at Execute.handler [as onResult] (D:\TabTracker\server\node_modules\sequelize\lib\dialects\mysql\query.js:51:23)
    at Execute.execute (D:\TabTracker\server\node_modules\mysql2\lib\commands\command.js:30:14)
    at Connection.handlePacket (D:\TabTracker\server\node_modules\mysql2\lib\connection.js:412:32)
    at PacketParser.onPacket (D:\TabTracker\server\node_modules\mysql2\lib\connection.js:70:12)
    at PacketParser.executeStart (D:\TabTracker\server\node_modules\mysql2\lib\packet_parser.js:75:16)
    at Socket.<anonymous> (D:\TabTracker\server\node_modules\mysql2\lib\connection.js:77:25)
    at Socket.emit (events.js:203:13)
    at addChunk (_stream_readable.js:294:12)
    at readableAddChunk (_stream_readable.js:275:11)
    at Socket.Readable.push (_stream_readable.js:210:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:166:17)

我通过-

创建了一个书签表
 Bookmark.belongsTo(Users)
 Bookmark.belongsTo(Songs)

但是每次我运行种子时,它都会引发未处理的拒绝SequelizeUniqueConstraintError:Query.formatError上的验证错误

,如果我手动插入数据并尝试通过邮递员获取该数据,则说无法获取/添加书签 请帮忙。

0 个答案:

没有答案