在续集中更新错误

Maz*_*zzy 6 mysql sequelize.js

这有什么错误?

Unhandled rejection SequelizeDatabaseError: ER_EMPTY_QUERY: Query was empty
    at Query.formatError (node_modules/sequelize/lib/dialects/mysql/query.js:159:14)
    at Query._callback (node_modules/sequelize/lib/dialects/mysql/query.js:35:21)
    at Query.Sequence.end (node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
    at Query.ErrorPacket (node_modules/mysql/lib/protocol/sequences/Query.js:94:8)
    at Protocol._parsePacket (node_modules/mysql/lib/protocol/Protocol.js:274:23)
    at Parser.write (node_modules/mysql/lib/protocol/Parser.js:77:12)
    at Protocol.write (node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (node_modules/mysql/lib/Connection.js:96:28)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
    at Socket.Readable.push (_stream_readable.js:126:10)
    at TCP.onread (net.js:538:20)
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用以下代码更新实体:

db.Account.update({
                    'post_id': data.id
                }, {
                  where: { id: account.id }
                })
                .spread(account => {

                  next();
                });
Run Code Online (Sandbox Code Playgroud)

但它不起作用.任何的想法?

vin*_*yal 18

我遇到的同样问题经过大量调试后发现了这个愚蠢的错误.我的原因是在mysql中添加了一个而忘了将相同的内容添加到代表同一个表的sequelize模型中,所以对于你的情况也会建议你只需要检查post_id是否存在于Account sequelize模型中.