{"action":"opened","number":3994,"pull_request":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/3994","id":38389303,"html_url":"https://github.com/sequelize/sequelize/pull/3994","diff_url":"https://github.com/sequelize/sequelize/pull/3994.diff","patch_url":"https://github.com/sequelize/sequelize/pull/3994.patch","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/3994","number":3994,"state":"open","locked":false,"title":"upsert overwrites data with default values on update","user":{"login":"FredKSchott","id":622227,"avatar_url":"https://avatars.githubusercontent.com/u/622227?v=3","gravatar_id":"","url":"https://api.github.com/users/FredKSchott","html_url":"https://github.com/FredKSchott","followers_url":"https://api.github.com/users/FredKSchott/followers","following_url":"https://api.github.com/users/FredKSchott/following{/other_user}","gists_url":"https://api.github.com/users/FredKSchott/gists{/gist_id}","starred_url":"https://api.github.com/users/FredKSchott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FredKSchott/subscriptions","organizations_url":"https://api.github.com/users/FredKSchott/orgs","repos_url":"https://api.github.com/users/FredKSchott/repos","events_url":"https://api.github.com/users/FredKSchott/events{/privacy}","received_events_url":"https://api.github.com/users/FredKSchott/received_events","type":"User","site_admin":false},"body":"Currently, a `defaultValue` set on the model will be used in every `upsert` operation. This is fine for when upsert INSERTs, since that is when default values are used/needed. However, upsert is also using defaultValue on INSERT, which is causing data to be overwritten and lost by the default values. \r\n\r\nI've included a test that is currently broken by this bug, I haven't had time to look into a fix yet.\r\n\r\n/cc @mickhansen @janmeier (from the last upsert issue we worked on)","created_at":"2015-06-23T22:16:36Z","updated_at":"2015-06-23T22:16:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sequelize/sequelize/pulls/3994/commits","review_comments_url":"https://api.github.com/repos/sequelize/sequelize/pulls/3994/comments","review_comment_url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/3994/comments","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/fffd1a39738c70155dddcd86a5845c0b926798cc","head":{"label":"FredKSchott:upsert-no-defaults","ref":"upsert-no-defaults","sha":"fffd1a39738c70155dddcd86a5845c0b926798cc","user":{"login":"FredKSchott","id":622227,"avatar_url":"https://avatars.githubusercontent.com/u/622227?v=3","gravatar_id":"","url":"https://api.github.com/users/FredKSchott","html_url":"https://github.com/FredKSchott","followers_url":"https://api.github.com/users/FredKSchott/followers","following_url":"https://api.github.com/users/FredKSchott/following{/other_user}","gists_url":"https://api.github.com/users/FredKSchott/gists{/gist_id}","starred_url":"https://api.github.com/users/FredKSchott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FredKSchott/subscriptions","organizations_url":"https://api.github.com/users/FredKSchott/orgs","repos_url":"https://api.github.com/users/FredKSchott/repos","events_url":"https://api.github.com/users/FredKSchott/events{/privacy}","received_events_url":"https://api.github.com/users/FredKSchott/received_events","type":"User","site_admin":false},"repo":{"id":36681303,"name":"sequelize","full_name":"FredKSchott/sequelize","owner":{"login":"FredKSchott","id":622227,"avatar_url":"https://avatars.githubusercontent.com/u/622227?v=3","gravatar_id":"","url":"https://api.github.com/users/FredKSchott","html_url":"https://github.com/FredKSchott","followers_url":"https://api.github.com/users/FredKSchott/followers","following_url":"https://api.github.com/users/FredKSchott/following{/other_user}","gists_url":"https://api.github.com/users/FredKSchott/gists{/gist_id}","starred_url":"https://api.github.com/users/FredKSchott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FredKSchott/subscriptions","organizations_url":"https://api.github.com/users/FredKSchott/orgs","repos_url":"https://api.github.com/users/FredKSchott/repos","events_url":"https://api.github.com/users/FredKSchott/events{/privacy}","received_events_url":"https://api.github.com/users/FredKSchott/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/FredKSchott/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/FredKSchott/sequelize","forks_url":"https://api.github.com/repos/FredKSchott/sequelize/forks","keys_url":"https://api.github.com/repos/FredKSchott/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FredKSchott/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FredKSchott/sequelize/teams","hooks_url":"https://api.github.com/repos/FredKSchott/sequelize/hooks","issue_events_url":"https://api.github.com/repos/FredKSchott/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/FredKSchott/sequelize/events","assignees_url":"https://api.github.com/repos/FredKSchott/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/FredKSchott/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/FredKSchott/sequelize/tags","blobs_url":"https://api.github.com/repos/FredKSchott/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FredKSchott/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FredKSchott/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/FredKSchott/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FredKSchott/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/FredKSchott/sequelize/languages","stargazers_url":"https://api.github.com/repos/FredKSchott/sequelize/stargazers","contributors_url":"https://api.github.com/repos/FredKSchott/sequelize/contributors","subscribers_url":"https://api.github.com/repos/FredKSchott/sequelize/subscribers","subscription_url":"https://api.github.com/repos/FredKSchott/sequelize/subscription","commits_url":"https://api.github.com/repos/FredKSchott/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/FredKSchott/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/FredKSchott/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/FredKSchott/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/FredKSchott/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/FredKSchott/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FredKSchott/sequelize/merges","archive_url":"https://api.github.com/repos/FredKSchott/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FredKSchott/sequelize/downloads","issues_url":"https://api.github.com/repos/FredKSchott/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/FredKSchott/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/FredKSchott/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/FredKSchott/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FredKSchott/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/FredKSchott/sequelize/releases{/id}","created_at":"2015-06-01T18:48:41Z","updated_at":"2015-06-01T18:48:43Z","pushed_at":"2015-06-23T22:12:51Z","git_url":"git://github.com/FredKSchott/sequelize.git","ssh_url":"git@github.com:FredKSchott/sequelize.git","clone_url":"https://github.com/FredKSchott/sequelize.git","svn_url":"https://github.com/FredKSchott/sequelize","homepage":"http://sequelizejs.com","size":14444,"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":"3015c2fb39d76b41df9170e54c3402d4a890b6b5","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-06-23T21:54:23Z","pushed_at":"2015-06-23T22:16:36Z","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":58027,"stargazers_count":4001,"watchers_count":4001,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":893,"mirror_url":null,"open_issues_count":431,"forks":893,"open_issues":431,"watchers":4001,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/3994"},"html":{"href":"https://github.com/sequelize/sequelize/pull/3994"},"issue":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/3994"},"comments":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/3994/comments"},"review_comments":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/3994/comments"},"review_comment":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/3994/commits"},"statuses":{"href":"https://api.github.com/repos/sequelize/sequelize/statuses/fffd1a39738c70155dddcd86a5845c0b926798cc"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":21,"deletions":1,"changed_files":1}}