This is my circle.yml
:
machine:
pre:
- mkdir ~/.yarn-cache
- curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0
node:
version: 7.6.0
environment:
NODE_ENV: test
services:
- mysql
- redis
dependencies:
pre:
- curl -o- -L https://yarnpkg.com/install.sh | bash
cache_directories:
- ~/.yarn-cache
override:
- yarn install
test:
override:
- yarn run mock
- yarn run test
- yarn run report-coverage
An error was throw when insert data into mysql. However, this error never happened in my local machine and production machine, and other ci enviroment. This error are as followed:
{ SequelizeBaseError: Field 'id' doesn't have a default value
at Query.formatError (/home/ubuntu/onlinejudge-backend/node_modules/sequelize/lib/dialects/mysql/query.js:217:16)
at Query.connection.query [as onResult] (/home/ubuntu/onlinejudge-backend/node_modules/sequelize/lib/dialects/mysql/query.js:55:23)
at Query.Command.execute (/home/ubuntu/onlinejudge-backend/node_modules/mysql2/lib/commands/command.js:30:12)
at Connection.handlePacket (/home/ubuntu/onlinejudge-backend/node_modules/mysql2/lib/connection.js:500:28)
at PacketParser.onPacket (/home/ubuntu/onlinejudge-backend/node_modules/mysql2/lib/connection.js:94:16)
at PacketParser.executeStart (/home/ubuntu/onlinejudge-backend/node_modules/mysql2/lib/packet_parser.js:77:14)
at Socket.<anonymous> (/home/ubuntu/onlinejudge-backend/node_modules/mysql2/lib/connection.js:102:29)
at emitOne (events.js:96:13)
at Socket.emit (events.js:189:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:551:20)
name: 'SequelizeDatabaseError',
parent:
{ Error: Field 'id' doesn't have a default value
at Packet.asError (/home/ubuntu/onlinejudge-backend/node_modules/mysql2/lib/packets/packet.js:701:13)
at Query.Command.execute (/home/ubuntu/onlinejudge-backend/node_modules/mysql2/lib/commands/command.js:28:22)
at Connection.handlePacket (/home/ubuntu/onlinejudge-backend/node_modules/mysql2/lib/connection.js:500:28)
at PacketParser.onPacket (/home/ubuntu/onlinejudge-backend/node_modules/mysql2/lib/connection.js:94:16)
at PacketParser.executeStart (/home/ubuntu/onlinejudge-backend/node_modules/mysql2/lib/packet_parser.js:77:14)
at Socket.<anonymous> (/home/ubuntu/onlinejudge-backend/node_modules/mysql2/lib/connection.js:102:29)
at emitOne (events.js:96:13)
at Socket.emit (events.js:189:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:551:20)
code: 'ER_NO_DEFAULT_FOR_FIELD',
errno: 1364,
sqlState: '#HY000',
sql: 'INSERT INTO `Users` (`name`,`email`,`password`,`createdAt`,`updatedAt`) VALUES (\'xxx123\',\'xxx.xxx@gmail.com\',\'15e2b0d3c33891ebb0f1ef609ec419420c20e320ce94c65fbc8c3312448eb225\',\'2017-06-03 13:44:12\',\'2017-06-03 13:44:12\');' },
Seems it reminds me that id
is necessary in the insert sql. But I had set id
to autoincrement and it behaves well in my local machine. Someone say it’s caused by the STRICT_TRANS_TABLES SQL mode. But I do not know how to set it.
Thanks.