{"action":"created","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/5827","repository_url":"https://api.github.com/repos/sequelize/sequelize","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/5827/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/5827/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/5827/events","html_url":"https://github.com/sequelize/sequelize/issues/5827","id":152061876,"number":5827,"title":"Can't update primary key","user":{"login":"atulhm","id":2037398,"avatar_url":"https://avatars.githubusercontent.com/u/2037398?v=3","gravatar_id":"","url":"https://api.github.com/users/atulhm","html_url":"https://github.com/atulhm","followers_url":"https://api.github.com/users/atulhm/followers","following_url":"https://api.github.com/users/atulhm/following{/other_user}","gists_url":"https://api.github.com/users/atulhm/gists{/gist_id}","starred_url":"https://api.github.com/users/atulhm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atulhm/subscriptions","organizations_url":"https://api.github.com/users/atulhm/orgs","repos_url":"https://api.github.com/users/atulhm/repos","events_url":"https://api.github.com/users/atulhm/events{/privacy}","received_events_url":"https://api.github.com/users/atulhm/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-05-01T01:02:43Z","updated_at":"2016-09-10T11:02:55Z","closed_at":"2016-05-10T07:12:35Z","body":"\r\nI'm having the same issue referenced in this stack overflow:\r\nhttp://stackoverflow.com/questions/33881189/sequelize-update-record-primary-key-value\r\n\r\nIssue has been traced down to: \r\nhttps://github.com/sequelize/sequelize/blob/f482790b85ef2336bb97893c0eaa127d9d6bbc77/lib/instance.js#L334-L336\r\n\r\nI'd be happy to provide a PR for this, but I'd like to understand the reasoning for the check first.  Please advise.\r\n\r\n## What you are doing?\r\nTrying to change a primary key value\r\n\r\n```js\r\n// model definition\r\nvar User = sequelize.define('users', {\r\n  id: {\r\n    type: DataTypes.STRING,\r\n    unique: true,\r\n    primaryKey: true,\r\n    field: 'id'\r\n  }\r\n)};\r\n\r\n// usage\r\nUser.findById(oldId).then(function(user) {\r\n user.id = 'new value';\r\n user.save(); // Id remains the same in DB\r\n});\r\n```\r\n\r\n## What do you expect to happen?\r\nuser.id should save with 'new value'\r\n\r\n## What is actually happening?\r\nuser.id reverts\r\n\r\n\r\n__Dialect:__ mysql \r\n__Database version:  5.7.11\r\n__Sequelize version:  sequelize@3.22.0\r\n"},"comment":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/comments/246105810","html_url":"https://github.com/sequelize/sequelize/issues/5827#issuecomment-246105810","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/5827","id":246105810,"user":{"login":"frogcjn","id":1777562,"avatar_url":"https://avatars.githubusercontent.com/u/1777562?v=3","gravatar_id":"","url":"https://api.github.com/users/frogcjn","html_url":"https://github.com/frogcjn","followers_url":"https://api.github.com/users/frogcjn/followers","following_url":"https://api.github.com/users/frogcjn/following{/other_user}","gists_url":"https://api.github.com/users/frogcjn/gists{/gist_id}","starred_url":"https://api.github.com/users/frogcjn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frogcjn/subscriptions","organizations_url":"https://api.github.com/users/frogcjn/orgs","repos_url":"https://api.github.com/users/frogcjn/repos","events_url":"https://api.github.com/users/frogcjn/events{/privacy}","received_events_url":"https://api.github.com/users/frogcjn/received_events","type":"User","site_admin":false},"created_at":"2016-09-10T11:02:55Z","updated_at":"2016-09-10T11:02:55Z","body":"This should be a bug? or an important notes in documentation? Because change primary key is a normal operation."}}
{"actor":{"display_login":"frogcjn"}}