{"action":"opened","number":5366,"pull_request":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/5366","id":58318524,"html_url":"https://github.com/sequelize/sequelize/pull/5366","diff_url":"https://github.com/sequelize/sequelize/pull/5366.diff","patch_url":"https://github.com/sequelize/sequelize/pull/5366.patch","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/5366","number":5366,"state":"open","locked":false,"title":"Set updatedAt and createdAt values before validation","user":{"login":"rafis","id":3502395,"avatar_url":"https://avatars.githubusercontent.com/u/3502395?v=3","gravatar_id":"","url":"https://api.github.com/users/rafis","html_url":"https://github.com/rafis","followers_url":"https://api.github.com/users/rafis/followers","following_url":"https://api.github.com/users/rafis/following{/other_user}","gists_url":"https://api.github.com/users/rafis/gists{/gist_id}","starred_url":"https://api.github.com/users/rafis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafis/subscriptions","organizations_url":"https://api.github.com/users/rafis/orgs","repos_url":"https://api.github.com/users/rafis/repos","events_url":"https://api.github.com/users/rafis/events{/privacy}","received_events_url":"https://api.github.com/users/rafis/received_events","type":"User","site_admin":false},"body":"If model has `updatedAt` or `createdAt` fields without allowing nulls:\r\n\r\n```javascript\r\n        createdAt: {\r\n            type: DataTypes.DATE,\r\n            allowNull: false,\r\n            field: 'created_at'\r\n        },\r\n        updatedAt: {\r\n            type: DataTypes.DATE,\r\n            allowNull: false,\r\n            field: 'update_at'\r\n        },\r\n```\r\n\r\nthen I'm receiving this error:\r\n\r\n> { [SequelizeValidationError: notNull Violation: createdAt cannot be null,\r\nnotNull Violation: updatedAt cannot be null]\r\n  name: 'SequelizeValidationError',\r\n  message: 'notNull Violation: createdAt cannot be null,\\nnotNull Violation: updatedAt cannot be null',\r\n  errors:\r\n   [ { message: 'createdAt cannot be null',\r\n       type: 'notNull Violation',\r\n       path: 'createdAt',\r\n       value: null },\r\n     { message: 'updatedAt cannot be null',\r\n       type: 'notNull Violation',\r\n       path: 'updatedAt',\r\n       value: null } ] }\r\n\r\nMy proposal is to set `updatedAt` and `createdAt` values before doing validation.\r\n\r\n**UPD**: Fixed `now`.","created_at":"2016-02-04T17:15:20Z","updated_at":"2016-02-04T17:15:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sequelize/sequelize/pulls/5366/commits","review_comments_url":"https://api.github.com/repos/sequelize/sequelize/pulls/5366/comments","review_comment_url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/5366/comments","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/3543ce6d8b2f0fd706572e0894923c2e47d9aa51","head":{"label":"rafis:master","ref":"master","sha":"3543ce6d8b2f0fd706572e0894923c2e47d9aa51","user":{"login":"rafis","id":3502395,"avatar_url":"https://avatars.githubusercontent.com/u/3502395?v=3","gravatar_id":"","url":"https://api.github.com/users/rafis","html_url":"https://github.com/rafis","followers_url":"https://api.github.com/users/rafis/followers","following_url":"https://api.github.com/users/rafis/following{/other_user}","gists_url":"https://api.github.com/users/rafis/gists{/gist_id}","starred_url":"https://api.github.com/users/rafis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafis/subscriptions","organizations_url":"https://api.github.com/users/rafis/orgs","repos_url":"https://api.github.com/users/rafis/repos","events_url":"https://api.github.com/users/rafis/events{/privacy}","received_events_url":"https://api.github.com/users/rafis/received_events","type":"User","site_admin":false},"repo":{"id":48176430,"name":"sequelize","full_name":"rafis/sequelize","owner":{"login":"rafis","id":3502395,"avatar_url":"https://avatars.githubusercontent.com/u/3502395?v=3","gravatar_id":"","url":"https://api.github.com/users/rafis","html_url":"https://github.com/rafis","followers_url":"https://api.github.com/users/rafis/followers","following_url":"https://api.github.com/users/rafis/following{/other_user}","gists_url":"https://api.github.com/users/rafis/gists{/gist_id}","starred_url":"https://api.github.com/users/rafis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafis/subscriptions","organizations_url":"https://api.github.com/users/rafis/orgs","repos_url":"https://api.github.com/users/rafis/repos","events_url":"https://api.github.com/users/rafis/events{/privacy}","received_events_url":"https://api.github.com/users/rafis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rafis/sequelize","description":"Sequelize is an easy-to-use multi sql dialect ORM for Node.js & io.js. It currently supports MySQL, MariaDB, SQLite, PostgreSQL and MSSQL.","fork":true,"url":"https://api.github.com/repos/rafis/sequelize","forks_url":"https://api.github.com/repos/rafis/sequelize/forks","keys_url":"https://api.github.com/repos/rafis/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rafis/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rafis/sequelize/teams","hooks_url":"https://api.github.com/repos/rafis/sequelize/hooks","issue_events_url":"https://api.github.com/repos/rafis/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/rafis/sequelize/events","assignees_url":"https://api.github.com/repos/rafis/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/rafis/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/rafis/sequelize/tags","blobs_url":"https://api.github.com/repos/rafis/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rafis/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rafis/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/rafis/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rafis/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/rafis/sequelize/languages","stargazers_url":"https://api.github.com/repos/rafis/sequelize/stargazers","contributors_url":"https://api.github.com/repos/rafis/sequelize/contributors","subscribers_url":"https://api.github.com/repos/rafis/sequelize/subscribers","subscription_url":"https://api.github.com/repos/rafis/sequelize/subscription","commits_url":"https://api.github.com/repos/rafis/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/rafis/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/rafis/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/rafis/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/rafis/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/rafis/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rafis/sequelize/merges","archive_url":"https://api.github.com/repos/rafis/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rafis/sequelize/downloads","issues_url":"https://api.github.com/repos/rafis/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/rafis/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/rafis/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/rafis/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rafis/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/rafis/sequelize/releases{/id}","deployments_url":"https://api.github.com/repos/rafis/sequelize/deployments","created_at":"2015-12-17T13:40:10Z","updated_at":"2016-02-04T16:46:25Z","pushed_at":"2016-02-04T17:06:38Z","git_url":"git://github.com/rafis/sequelize.git","ssh_url":"git@github.com:rafis/sequelize.git","clone_url":"https://github.com/rafis/sequelize.git","svn_url":"https://github.com/rafis/sequelize","homepage":"http://sequelizejs.com","size":17024,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sequelize:master","ref":"master","sha":"e5ce660ab868f169e23aad7bf386cddab4e63f5e","user":{"login":"sequelize","id":3591786,"avatar_url":"https://avatars.githubusercontent.com/u/3591786?v=3","gravatar_id":"","url":"https://api.github.com/users/sequelize","html_url":"https://github.com/sequelize","followers_url":"https://api.github.com/users/sequelize/followers","following_url":"https://api.github.com/users/sequelize/following{/other_user}","gists_url":"https://api.github.com/users/sequelize/gists{/gist_id}","starred_url":"https://api.github.com/users/sequelize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sequelize/subscriptions","organizations_url":"https://api.github.com/users/sequelize/orgs","repos_url":"https://api.github.com/users/sequelize/repos","events_url":"https://api.github.com/users/sequelize/events{/privacy}","received_events_url":"https://api.github.com/users/sequelize/received_events","type":"Organization","site_admin":false},"repo":{"id":790359,"name":"sequelize","full_name":"sequelize/sequelize","owner":{"login":"sequelize","id":3591786,"avatar_url":"https://avatars.githubusercontent.com/u/3591786?v=3","gravatar_id":"","url":"https://api.github.com/users/sequelize","html_url":"https://github.com/sequelize","followers_url":"https://api.github.com/users/sequelize/followers","following_url":"https://api.github.com/users/sequelize/following{/other_user}","gists_url":"https://api.github.com/users/sequelize/gists{/gist_id}","starred_url":"https://api.github.com/users/sequelize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sequelize/subscriptions","organizations_url":"https://api.github.com/users/sequelize/orgs","repos_url":"https://api.github.com/users/sequelize/repos","events_url":"https://api.github.com/users/sequelize/events{/privacy}","received_events_url":"https://api.github.com/users/sequelize/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sequelize/sequelize","description":"Sequelize is an easy-to-use multi sql dialect ORM for Node.js & io.js. It currently supports MySQL, MariaDB, SQLite, PostgreSQL and MSSQL.","fork":false,"url":"https://api.github.com/repos/sequelize/sequelize","forks_url":"https://api.github.com/repos/sequelize/sequelize/forks","keys_url":"https://api.github.com/repos/sequelize/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sequelize/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sequelize/sequelize/teams","hooks_url":"https://api.github.com/repos/sequelize/sequelize/hooks","issue_events_url":"https://api.github.com/repos/sequelize/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/sequelize/sequelize/events","assignees_url":"https://api.github.com/repos/sequelize/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/sequelize/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/sequelize/sequelize/tags","blobs_url":"https://api.github.com/repos/sequelize/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sequelize/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sequelize/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/sequelize/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/sequelize/sequelize/languages","stargazers_url":"https://api.github.com/repos/sequelize/sequelize/stargazers","contributors_url":"https://api.github.com/repos/sequelize/sequelize/contributors","subscribers_url":"https://api.github.com/repos/sequelize/sequelize/subscribers","subscription_url":"https://api.github.com/repos/sequelize/sequelize/subscription","commits_url":"https://api.github.com/repos/sequelize/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/sequelize/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/sequelize/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/sequelize/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/sequelize/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/sequelize/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sequelize/sequelize/merges","archive_url":"https://api.github.com/repos/sequelize/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sequelize/sequelize/downloads","issues_url":"https://api.github.com/repos/sequelize/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/sequelize/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/sequelize/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/sequelize/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sequelize/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/sequelize/sequelize/releases{/id}","deployments_url":"https://api.github.com/repos/sequelize/sequelize/deployments","created_at":"2010-07-22T07:11:11Z","updated_at":"2016-02-04T16:06:58Z","pushed_at":"2016-02-04T16:47:01Z","git_url":"git://github.com/sequelize/sequelize.git","ssh_url":"git@github.com:sequelize/sequelize.git","clone_url":"https://github.com/sequelize/sequelize.git","svn_url":"https://github.com/sequelize/sequelize","homepage":"http://sequelizejs.com","size":53725,"stargazers_count":5676,"watchers_count":5676,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1223,"mirror_url":null,"open_issues_count":677,"forks":1223,"open_issues":677,"watchers":5676,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/5366"},"html":{"href":"https://github.com/sequelize/sequelize/pull/5366"},"issue":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/5366"},"comments":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/5366/comments"},"review_comments":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/5366/comments"},"review_comment":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/5366/commits"},"statuses":{"href":"https://api.github.com/repos/sequelize/sequelize/statuses/3543ce6d8b2f0fd706572e0894923c2e47d9aa51"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":37,"deletions":12,"changed_files":2}}