{"action":"created","comment":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments/41086938","id":41086938,"diff_hunk":"@@ -266,10 +269,95 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), function() {\n   });\n \n   describe('datatype validations', function () {\n-    describe('should throw validationerror', function () {\n-      var User = current.define('user', {\n-        age: Sequelize.INTEGER\n+    current = Support.createSequelizeInstance({\n+      validation: true\n+    });\n+\n+    var User = current.define('user', {\n+      age: Sequelize.INTEGER,\n+      name: Sequelize.STRING,\n+      awesome: Sequelize.BOOLEAN,\n+      number: Sequelize.DECIMAL,\n+      uid: Sequelize.UUID\n+    });\n+\n+    before(function () {\n+      this.stub = sinon.stub(current, 'query', function () {\n+        return new Promise(function (resolve) {\n+          resolve(User.build({}));\n+        });\n       });\n+    });\n+\n+    after(function () {\n+      this.stub.restore();\n+    });\n+\n+    describe('should not throw', function () {\n+      describe('create', function () {\n+        it('should allow number as a string', function () {\n+          return expect(User.create({\n+            age: '12'\n+          })).not.to.be.rejected;\n+        });\n+\n+        it('should allow decimal as a string', function () {\n+          return expect(User.create({\n+            number: '12.6'\n+          })).not.to.be.rejected;\n+        });\n+\n+        it('should allow string as a number', function () {\n+          return expect(User.create({\n+            name: 12\n+          })).not.to.be.rejected;\n+        });\n+\n+        it('should allow 0/1 as a boolean', function () {\n+          return expect(User.create({\n+            awesome: 1\n+          })).not.to.be.rejected;\n+        });\n+\n+        it('should allow 0/1 string as a boolean', function () {\n+          return expect(User.create({\n+            awesome: '1'\n+          })).not.to.be.rejected;\n+        });\n+\n+        it('should allow true/false string as a boolean', function () {\n+          return expect(User.create({\n+            awesome: 'true'\n+          })).not.to.be.rejected;\n+        });","path":"test/unit/model/validation.test.js","position":83,"original_position":83,"commit_id":"1d4535b099a08da568f7a756cbf6ce509d54f31e","original_commit_id":"1d4535b099a08da568f7a756cbf6ce509d54f31e","user":{"login":"janmeier","id":1210224,"avatar_url":"https://avatars.githubusercontent.com/u/1210224?v=3","gravatar_id":"","url":"https://api.github.com/users/janmeier","html_url":"https://github.com/janmeier","followers_url":"https://api.github.com/users/janmeier/followers","following_url":"https://api.github.com/users/janmeier/following{/other_user}","gists_url":"https://api.github.com/users/janmeier/gists{/gist_id}","starred_url":"https://api.github.com/users/janmeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janmeier/subscriptions","organizations_url":"https://api.github.com/users/janmeier/orgs","repos_url":"https://api.github.com/users/janmeier/repos","events_url":"https://api.github.com/users/janmeier/events{/privacy}","received_events_url":"https://api.github.com/users/janmeier/received_events","type":"User","site_admin":false},"body":"Nah, I must have been thinking about an older issue","created_at":"2015-10-03T13:05:36Z","updated_at":"2015-10-03T13:05:36Z","html_url":"https://github.com/sequelize/sequelize/pull/4604#discussion_r41086938","pull_request_url":"https://api.github.com/repos/sequelize/sequelize/pulls/4604","_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments/41086938"},"html":{"href":"https://github.com/sequelize/sequelize/pull/4604#discussion_r41086938"},"pull_request":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/4604"}}},"pull_request":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/4604","id":46703224,"html_url":"https://github.com/sequelize/sequelize/pull/4604","diff_url":"https://github.com/sequelize/sequelize/pull/4604.diff","patch_url":"https://github.com/sequelize/sequelize/pull/4604.patch","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/4604","number":4604,"state":"open","locked":false,"title":"feat(validations) Partial rollback of datatype validation by hiding b…","user":{"login":"janmeier","id":1210224,"avatar_url":"https://avatars.githubusercontent.com/u/1210224?v=3","gravatar_id":"","url":"https://api.github.com/users/janmeier","html_url":"https://github.com/janmeier","followers_url":"https://api.github.com/users/janmeier/followers","following_url":"https://api.github.com/users/janmeier/following{/other_user}","gists_url":"https://api.github.com/users/janmeier/gists{/gist_id}","starred_url":"https://api.github.com/users/janmeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janmeier/subscriptions","organizations_url":"https://api.github.com/users/janmeier/orgs","repos_url":"https://api.github.com/users/janmeier/repos","events_url":"https://api.github.com/users/janmeier/events{/privacy}","received_events_url":"https://api.github.com/users/janmeier/received_events","type":"User","site_admin":false},"body":"…ehind a flag. Soften up some validation and restrict them to insert and create\r\n\r\nAdresses https://github.com/sequelize/sequelize/issues/4314\r\n\r\nI've hidden the validations behind a flag `validations`, which is false by default - which menas they are practically rolled back unless the user manually enables them.\r\n\r\nFurthermore, I've restricted the validations to only run on insert, bulkinsert and update, not findAll etc. I still believe there would be some merit to validation find query args, but there are also lots of complications, as the issues mentinoed in https://github.com/sequelize/sequelize/issues/4314 show - e.g $in array and $like str%, for uuid etc.\r\n\r\nI also refactored bulkInsert into the abstract query generator, since the code was 90% the same for mysql, sqlite and pg","created_at":"2015-10-03T10:11:01Z","updated_at":"2015-10-03T13:05:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"45b6358633e45eaf90a0f3fd22b3706afb69dc29","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sequelize/sequelize/pulls/4604/commits","review_comments_url":"https://api.github.com/repos/sequelize/sequelize/pulls/4604/comments","review_comment_url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/4604/comments","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/1d4535b099a08da568f7a756cbf6ce509d54f31e","head":{"label":"sequelize:validationsRollback","ref":"validationsRollback","sha":"1d4535b099a08da568f7a756cbf6ce509d54f31e","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}","created_at":"2010-07-22T07:11:11Z","updated_at":"2015-10-03T12:00:53Z","pushed_at":"2015-10-03T11:13:58Z","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":60888,"stargazers_count":4652,"watchers_count":4652,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1047,"mirror_url":null,"open_issues_count":536,"forks":1047,"open_issues":536,"watchers":4652,"default_branch":"master"}},"base":{"label":"sequelize:master","ref":"master","sha":"18627d1905b137d13243ad49c49cacbe05455072","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}","created_at":"2010-07-22T07:11:11Z","updated_at":"2015-10-03T12:00:53Z","pushed_at":"2015-10-03T11:13:58Z","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":60888,"stargazers_count":4652,"watchers_count":4652,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1047,"mirror_url":null,"open_issues_count":536,"forks":1047,"open_issues":536,"watchers":4652,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/4604"},"html":{"href":"https://github.com/sequelize/sequelize/pull/4604"},"issue":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/4604"},"comments":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/4604/comments"},"review_comments":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/4604/comments"},"review_comment":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/4604/commits"},"statuses":{"href":"https://api.github.com/repos/sequelize/sequelize/statuses/1d4535b099a08da568f7a756cbf6ce509d54f31e"}}}}