{"action":"created","issue":{"url":"https://api.github.com/repos/sequelize/cli/issues/652","repository_url":"https://api.github.com/repos/sequelize/cli","labels_url":"https://api.github.com/repos/sequelize/cli/issues/652/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/cli/issues/652/comments","events_url":"https://api.github.com/repos/sequelize/cli/issues/652/events","html_url":"https://github.com/sequelize/cli/issues/652","id":325661000,"node_id":"MDU6SXNzdWUzMjU2NjEwMDA=","number":652,"title":"\"Field 'createdAt' doesn't have a default value\" after timestamps are added to SequelizeMeta","user":{"login":"mixecan","id":7155749,"node_id":"MDQ6VXNlcjcxNTU3NDk=","avatar_url":"https://avatars0.githubusercontent.com/u/7155749?v=4","gravatar_id":"","url":"https://api.github.com/users/mixecan","html_url":"https://github.com/mixecan","followers_url":"https://api.github.com/users/mixecan/followers","following_url":"https://api.github.com/users/mixecan/following{/other_user}","gists_url":"https://api.github.com/users/mixecan/gists{/gist_id}","starred_url":"https://api.github.com/users/mixecan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixecan/subscriptions","organizations_url":"https://api.github.com/users/mixecan/orgs","repos_url":"https://api.github.com/users/mixecan/repos","events_url":"https://api.github.com/users/mixecan/events{/privacy}","received_events_url":"https://api.github.com/users/mixecan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-23T11:20:46Z","updated_at":"2018-06-05T18:34:00Z","closed_at":null,"author_association":"NONE","body":"## What you are doing?\r\n<!-- Post a minimal, self-contained code sample that reproduces the issue, include config and migration file(s) -->\r\nI'm trying to run the migration scripts after `createdAt`and `updatedAt` columns are added to the migration table.\r\n\r\n```bash\r\nsequelize db:migrate:status\r\nsequelize db:migrate --to migration1.js\r\nsequelize db:migrate:schema:timestamps:add\r\nsequelize db:migrate --to migration2.js\r\n```\r\n\r\n## What do you expect to happen?\r\nTo completed the migration.\r\n\r\n## What is actually happening?\r\n`createdAt` and `updatedAt` columns haven't any values when the migration is added to `SequelizeMeta`.\r\n```\r\nERROR: SequelizeDatabaseError: Field 'createdAt' doesn't have a default value\r\n    at Query.formatError (~/project/node_modules/sequelize/lib/dialects/mysql/query.js:247:16)\r\n    at Query.handler [as onResult] (~/project/node_modules/sequelize/lib/dialects/mysql/query.js:68:23)\r\n    at Query.Command.execute (~/project/node_modules/mysql2/lib/commands/command.js:30:12)\r\n    at Connection.handlePacket (~/project/node_modules/mysql2/lib/connection.js:502:28)\r\n    at PacketParser.onPacket (~/project/node_modules/mysql2/lib/connection.js:81:16)\r\n    at PacketParser.executeStart (~/project/node_modules/mysql2/lib/packet_parser.js:77:14)\r\n    at Socket.<anonymous> (~/project/node_modules/mysql2/lib/connection.js:89:29)\r\n    at emitOne (events.js:116:13)\r\n    at Socket.emit (events.js:211:7)\r\n    at addChunk (_stream_readable.js:263:12)\r\n    at readableAddChunk (_stream_readable.js:250:11)\r\n    at Socket.Readable.push (_stream_readable.js:208:10)\r\n    at TCP.onread (net.js:594:20)\r\n```\r\n\r\n__Dialect:__ mysql\r\n__Database version:__ 5.7\r\n__Sequelize CLI version:__ 4.0.0\r\n__Sequelize version:__ 4.37.7\r\n"},"comment":{"url":"https://api.github.com/repos/sequelize/cli/issues/comments/394814897","html_url":"https://github.com/sequelize/cli/issues/652#issuecomment-394814897","issue_url":"https://api.github.com/repos/sequelize/cli/issues/652","id":394814897,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDgxNDg5Nw==","user":{"login":"ox","id":103545,"node_id":"MDQ6VXNlcjEwMzU0NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/103545?v=4","gravatar_id":"","url":"https://api.github.com/users/ox","html_url":"https://github.com/ox","followers_url":"https://api.github.com/users/ox/followers","following_url":"https://api.github.com/users/ox/following{/other_user}","gists_url":"https://api.github.com/users/ox/gists{/gist_id}","starred_url":"https://api.github.com/users/ox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ox/subscriptions","organizations_url":"https://api.github.com/users/ox/orgs","repos_url":"https://api.github.com/users/ox/repos","events_url":"https://api.github.com/users/ox/events{/privacy}","received_events_url":"https://api.github.com/users/ox/received_events","type":"User","site_admin":false},"created_at":"2018-06-05T18:34:00Z","updated_at":"2018-06-05T18:34:00Z","author_association":"NONE","body":"I was experiencing this same issue and was unable to get migrations to log that they were run in the DB. We reverted the changes made by `db:mgirate:schema:timestamps:add` by running the following SQL:\r\n\r\n```sql\r\nbegin;\r\nalter table \"SequelizeMeta\" drop column if exists \"createdAt\";\r\nalter table \"SequelizeMeta\" drop column if exists \"updatedAt\";\r\ncommit;\r\n```\r\n\r\nAfter this, migrations were able to be logged into the SequelizeMeta table again."}}
{"actor":{"display_login":"ox"}}