{"action":"opened","number":9260,"pull_request":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/9260","id":178818063,"html_url":"https://github.com/sequelize/sequelize/pull/9260","diff_url":"https://github.com/sequelize/sequelize/pull/9260.diff","patch_url":"https://github.com/sequelize/sequelize/pull/9260.patch","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/9260","number":9260,"state":"open","locked":false,"title":"fix(model): potential fix for #6423","user":{"login":"rogerc","id":955105,"avatar_url":"https://avatars2.githubusercontent.com/u/955105?v=4","gravatar_id":"","url":"https://api.github.com/users/rogerc","html_url":"https://github.com/rogerc","followers_url":"https://api.github.com/users/rogerc/followers","following_url":"https://api.github.com/users/rogerc/following{/other_user}","gists_url":"https://api.github.com/users/rogerc/gists{/gist_id}","starred_url":"https://api.github.com/users/rogerc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogerc/subscriptions","organizations_url":"https://api.github.com/users/rogerc/orgs","repos_url":"https://api.github.com/users/rogerc/repos","events_url":"https://api.github.com/users/rogerc/events{/privacy}","received_events_url":"https://api.github.com/users/rogerc/received_events","type":"User","site_admin":false},"body":"<!-- \r\nThanks for wanting to fix something on Sequelize - we already love you long time!\r\nPlease fill in the template below.\r\nIf unsure about something, just do as best as you're able.\r\n\r\nIf your PR only contains changes to documentation, you may skip the template below.\r\n-->\r\n\r\n### Pull Request check-list\r\n\r\n_Please make sure to review and check all of these items:_\r\n\r\n- [ ] Does `npm run test` or `npm run test-DIALECT` pass with this change (including linting)?\r\n- [x] Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?\r\n- [ ] Have you added new tests to prevent regressions?\r\n- [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?\r\n- [x] Did you follow the commit message conventions explained in [CONTRIBUTING.md](../CONTRIBUTING.md)?\r\n\r\n<!-- NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open. -->\r\n\r\n### Description of change\r\n\r\nCan provide a fix for #6423 to match what most users expect when defining **_underscored_** in the options.\r\n\r\nProvides snake_case for all property names by setting field to snake_case\r\nbut keeping the name as camelCase.\r\n\r\nThe alternative is to manually define a hook which most users won't.\r\n\r\n```\r\nsequelize.addHook('beforeDefine', (attributes) => {\r\n    Object.keys(attributes).forEach((name) => {\r\n        if (typeof attributes[name] !== 'function') {\r\n            attribute = attributes[name];\r\n            const _underscored = attribute.underscored === undefined ? sequelize.options.define.underscored : attribute.underscored;\r\n            if (attribute.field === undefined && _underscored !== undefined) {\r\n                attribute.field = sequelize.Utils.underscoredIf(name, _underscored);\r\n            }\r\n        }\r\n    });\r\n});\r\n```\r\n**NOTE: I tested the code with my own code and worked as expected but could not run any of the tests in my environment (MacOS) or Docker on MacOS. The changes are minimal and current tests should cover the change**","created_at":"2018-04-02T10:54:56Z","updated_at":"2018-04-02T10:54:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sequelize/sequelize/pulls/9260/commits","review_comments_url":"https://api.github.com/repos/sequelize/sequelize/pulls/9260/comments","review_comment_url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/9260/comments","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/eddc3255eeb4fff83afb89a3dbaeb78b3a550c49","head":{"label":"rogerc:master","ref":"master","sha":"eddc3255eeb4fff83afb89a3dbaeb78b3a550c49","user":{"login":"rogerc","id":955105,"avatar_url":"https://avatars2.githubusercontent.com/u/955105?v=4","gravatar_id":"","url":"https://api.github.com/users/rogerc","html_url":"https://github.com/rogerc","followers_url":"https://api.github.com/users/rogerc/followers","following_url":"https://api.github.com/users/rogerc/following{/other_user}","gists_url":"https://api.github.com/users/rogerc/gists{/gist_id}","starred_url":"https://api.github.com/users/rogerc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogerc/subscriptions","organizations_url":"https://api.github.com/users/rogerc/orgs","repos_url":"https://api.github.com/users/rogerc/repos","events_url":"https://api.github.com/users/rogerc/events{/privacy}","received_events_url":"https://api.github.com/users/rogerc/received_events","type":"User","site_admin":false},"repo":{"id":127645729,"name":"sequelize","full_name":"rogerc/sequelize","owner":{"login":"rogerc","id":955105,"avatar_url":"https://avatars2.githubusercontent.com/u/955105?v=4","gravatar_id":"","url":"https://api.github.com/users/rogerc","html_url":"https://github.com/rogerc","followers_url":"https://api.github.com/users/rogerc/followers","following_url":"https://api.github.com/users/rogerc/following{/other_user}","gists_url":"https://api.github.com/users/rogerc/gists{/gist_id}","starred_url":"https://api.github.com/users/rogerc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogerc/subscriptions","organizations_url":"https://api.github.com/users/rogerc/orgs","repos_url":"https://api.github.com/users/rogerc/repos","events_url":"https://api.github.com/users/rogerc/events{/privacy}","received_events_url":"https://api.github.com/users/rogerc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rogerc/sequelize","description":"An easy-to-use multi SQL dialect ORM for Node.js","fork":true,"url":"https://api.github.com/repos/rogerc/sequelize","forks_url":"https://api.github.com/repos/rogerc/sequelize/forks","keys_url":"https://api.github.com/repos/rogerc/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rogerc/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rogerc/sequelize/teams","hooks_url":"https://api.github.com/repos/rogerc/sequelize/hooks","issue_events_url":"https://api.github.com/repos/rogerc/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/rogerc/sequelize/events","assignees_url":"https://api.github.com/repos/rogerc/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/rogerc/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/rogerc/sequelize/tags","blobs_url":"https://api.github.com/repos/rogerc/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rogerc/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rogerc/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/rogerc/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rogerc/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/rogerc/sequelize/languages","stargazers_url":"https://api.github.com/repos/rogerc/sequelize/stargazers","contributors_url":"https://api.github.com/repos/rogerc/sequelize/contributors","subscribers_url":"https://api.github.com/repos/rogerc/sequelize/subscribers","subscription_url":"https://api.github.com/repos/rogerc/sequelize/subscription","commits_url":"https://api.github.com/repos/rogerc/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/rogerc/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/rogerc/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/rogerc/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/rogerc/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/rogerc/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rogerc/sequelize/merges","archive_url":"https://api.github.com/repos/rogerc/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rogerc/sequelize/downloads","issues_url":"https://api.github.com/repos/rogerc/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/rogerc/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/rogerc/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/rogerc/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rogerc/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/rogerc/sequelize/releases{/id}","deployments_url":"https://api.github.com/repos/rogerc/sequelize/deployments","created_at":"2018-04-01T15:57:12Z","updated_at":"2018-04-01T17:43:37Z","pushed_at":"2018-04-01T17:43:36Z","git_url":"git://github.com/rogerc/sequelize.git","ssh_url":"git@github.com:rogerc/sequelize.git","clone_url":"https://github.com/rogerc/sequelize.git","svn_url":"https://github.com/rogerc/sequelize","homepage":"http://docs.sequelizejs.com","size":22110,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sequelize:master","ref":"master","sha":"e8d57201e04f9fab32b6f77588256e260710d57c","user":{"login":"sequelize","id":3591786,"avatar_url":"https://avatars0.githubusercontent.com/u/3591786?v=4","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://avatars0.githubusercontent.com/u/3591786?v=4","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":"An easy-to-use multi SQL dialect ORM for Node.js","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":"2018-04-02T09:56:07Z","pushed_at":"2018-04-02T04:44:21Z","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://docs.sequelizejs.com","size":22118,"stargazers_count":13749,"watchers_count":13749,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2399,"mirror_url":null,"archived":false,"open_issues_count":355,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":2399,"open_issues":355,"watchers":13749,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/9260"},"html":{"href":"https://github.com/sequelize/sequelize/pull/9260"},"issue":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/9260"},"comments":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/9260/comments"},"review_comments":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/9260/comments"},"review_comment":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/9260/commits"},"statuses":{"href":"https://api.github.com/repos/sequelize/sequelize/statuses/eddc3255eeb4fff83afb89a3dbaeb78b3a550c49"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":7,"deletions":2,"changed_files":1}}
{"actor":{"display_login":"rogerc"}}