gpt4 book ai didi

mysql - mysql 上的 ER_PARSE_ERROR Sequelize 字符串数据类型数组

转载 作者:行者123 更新时间:2023-11-29 21:09:29 24 4
gpt4 key购买 nike

对于下面的代码:

var User = sequelize.define('User', {
providerIds: { type : DataTypes.ARRAY(DataTypes.STRING)}

}

我收到以下错误:

Unhandled rejection SequelizeDatabaseError: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[], `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, `ReviewId` INT' at line 1
at Query.formatError (/media/mydata/projects/jobcuejs/node_modules/sequelize/lib/dialects/mysql/query.js:175:14)
at Query._callback (/media/mydata/projects/jobcuejs/node_modules/sequelize/lib/dialects/mysql/query.js:49:21)
at Query.Sequence.end (/media/mydata/projects/jobcuejs/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
at Query.ErrorPacket (/media/mydata/projects/jobcuejs/node_modules/mysql/lib/protocol/sequences/Query.js:94:8)
at Protocol._parsePacket (/media/mydata/projects/jobcuejs/node_modules/mysql/lib/protocol/Protocol.js:280:23)
at Parser.write (/media/mydata/projects/jobcuejs/node_modules/mysql/lib/protocol/Parser.js:73:12)
at Protocol.write (/media/mydata/projects/jobcuejs/node_modules/mysql/lib/protocol/Protocol.js:39:16)
at Socket.<anonymous> (/media/mydata/projects/jobcuejs/node_modules/mysql/lib/Connection.js:96:28)
at Socket.EventEmitter.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:746:14)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:408:10)
at emitReadable (_stream_readable.js:404:5)
at readableAddChunk (_stream_readable.js:165:9)
at Socket.Readable.push (_stream_readable.js:127:10)
at TCP.onread (net.js:526:21)

我做错了什么?

>mysql --version
mysql Ver 14.14 Distrib 5.6.28, for debian-linux-gnu (x86_64) using EditLine wrapper

最佳答案

类型数组,例如数据类型.ARRAY(数据类型.DECIMAL)。仅在 postgres 中可用。

访问http://docs.sequelizejs.com/en/latest/api/datatypes/?highlight=array#array

关于mysql - mysql 上的 ER_PARSE_ERROR Sequelize 字符串数据类型数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36514275/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com