{"action":"created","issue":{"url":"https://api.github.com/repos/dynamoosejs/dynamoose/issues/440","repository_url":"https://api.github.com/repos/dynamoosejs/dynamoose","labels_url":"https://api.github.com/repos/dynamoosejs/dynamoose/issues/440/labels{/name}","comments_url":"https://api.github.com/repos/dynamoosejs/dynamoose/issues/440/comments","events_url":"https://api.github.com/repos/dynamoosejs/dynamoose/issues/440/events","html_url":"https://github.com/dynamoosejs/dynamoose/pull/440","id":369973691,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyNzYzMzU5","number":440,"title":"Make debugging index creation dramatically easier","user":{"login":"williscool","id":394931,"node_id":"MDQ6VXNlcjM5NDkzMQ==","avatar_url":"https://avatars0.githubusercontent.com/u/394931?v=4","gravatar_id":"","url":"https://api.github.com/users/williscool","html_url":"https://github.com/williscool","followers_url":"https://api.github.com/users/williscool/followers","following_url":"https://api.github.com/users/williscool/following{/other_user}","gists_url":"https://api.github.com/users/williscool/gists{/gist_id}","starred_url":"https://api.github.com/users/williscool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/williscool/subscriptions","organizations_url":"https://api.github.com/users/williscool/orgs","repos_url":"https://api.github.com/users/williscool/repos","events_url":"https://api.github.com/users/williscool/events{/privacy}","received_events_url":"https://api.github.com/users/williscool/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-10-15T02:16:59Z","updated_at":"2018-10-15T09:29:37Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/dynamoosejs/dynamoose/pulls/440","html_url":"https://github.com/dynamoosejs/dynamoose/pull/440","diff_url":"https://github.com/dynamoosejs/dynamoose/pull/440.diff","patch_url":"https://github.com/dynamoosejs/dynamoose/pull/440.patch"},"body":"Currently Its not obvious how index's are managed in dynamoose.\r\n\r\nCreation using \r\n\r\n```\r\ndynamoose.model(name, schema, {update: true})\r\n```\r\n\r\nas mentioned in #221 \r\n\r\nWill **_delete_ the indexes that are currently on a table.** Which is a HUGE NO NO in production. \r\n\r\nEspecially since they can take non trivial amounts of time to get back setup... which at best causes service degradation and at worse downtime.\r\n\r\nThis new change allows you to use\r\n\r\n```\r\nDEBUG=dynamoose:table*  <how ever you start your server i.e. node server.js or yarn serve>\r\n```\r\n\r\nAnd see the difference in the console i.e.\r\n\r\n```\r\n  dynamoose:table compareIndexes +0ms\r\nindexs for compare local: { IndexName: 'fb_id-index',\r\n  KeySchema:\r\n   [ { AttributeName: 'fb_id', KeyType: 'HASH' },\r\n     { AttributeName: 'fb-id', KeyType: 'RANGE' } ],\r\n  Projection: { ProjectionType: 'ALL' } } remote: { IndexName: 'fb_id-index',\r\n  KeySchema: [ { AttributeName: 'fb_id', KeyType: 'HASH' } ],\r\n  Projection: { ProjectionType: 'ALL' } }\r\nindexs for compare local: { IndexName: 'phone_number-index',\r\n  KeySchema:\r\n   [ { AttributeName: 'phone_number', KeyType: 'HASH' },\r\n     { AttributeName: 'phone_number', KeyType: 'RANGE' } ],\r\n  Projection: { ProjectionType: 'ALL' } } remote: { IndexName: 'phone_number-index',\r\n  KeySchema: [ { AttributeName: 'phone_number', KeyType: 'HASH' } ],\r\n  Projection: { ProjectionType: 'ALL' } }\r\n\r\n\r\nblah blah blah\r\n\r\n  dynamoose:table devTickets indexes are not synchronized and update flag is set to false +1ms\r\n```\r\n\r\nYou can use this information to figure out what is different between the indexes on the table that exist versus the ones that you have setup in your dynamoose model.\r\n\r\nAnd change accordingly\r\n\r\nMUUCH better way to deal with \r\n\r\n```\r\nError: indexes are not synchronized and update flag is set to false\r\n```\r\nThan before\r\n\r\n### Type (select 1):\r\n- [ ] Bug fix\r\n- [x] Feature implementation\r\n- [ ] Documentation improvement\r\n- [ ] Testing improvement\r\n<!-- If you select the option below, please replace `---` below with the issue number of the GitHub issue raised, and the user who asked you to submit a broken test -->\r\n- [ ] Test added to report bug (GitHub issue #--- @---)\r\n- [ ] Something not listed here\r\n\r\n\r\n### Is this a breaking change? (select 1):\r\n- [ ] 🚨 YES 🚨\r\n- [x] No\r\n- [ ] I'm not sure\r\n\r\n\r\n### Is this ready to be merged into Dynamoose? (select 1):\r\n- [x] Yes\r\n- [ ] No\r\n\r\n\r\n### Are all the tests currently passing on this PR? (select 1):\r\n- [x] Yes\r\n- [ ] No\r\n\r\n\r\n### Other:\r\n- [x] I have searched through the GitHub pull requests to ensure this PR has not already been submitted\r\n- [ ] I have updated the Dynamoose documentation (if required) given the changes I made\r\n- [ ] I have added/updated the Dynamoose test cases (if required) given the changes I made\r\n- [ ] I have run `npm test` from the root of the project directory to ensure all tests continue to pass\r\n- [ ] I agree that all changes made in this pull request may be distributed and are made available in accordance with the [Dynamoose license](https://github.com/dynamoosejs/dynamoose/blob/master/LICENSE.txt)\r\n- [ ] All of my commits and commit messages are detailed, explain what changes were made, and are easy to follow and understand\r\n- [ ] I have confirmed that all my code changes are indented properly using 2 spaces\r\n- [ ] I have filled out all fields above\r\n"},"comment":{"url":"https://api.github.com/repos/dynamoosejs/dynamoose/issues/comments/429773134","html_url":"https://github.com/dynamoosejs/dynamoose/pull/440#issuecomment-429773134","issue_url":"https://api.github.com/repos/dynamoosejs/dynamoose/issues/440","id":429773134,"node_id":"MDEyOklzc3VlQ29tbWVudDQyOTc3MzEzNA==","user":{"login":"williscool","id":394931,"node_id":"MDQ6VXNlcjM5NDkzMQ==","avatar_url":"https://avatars0.githubusercontent.com/u/394931?v=4","gravatar_id":"","url":"https://api.github.com/users/williscool","html_url":"https://github.com/williscool","followers_url":"https://api.github.com/users/williscool/followers","following_url":"https://api.github.com/users/williscool/following{/other_user}","gists_url":"https://api.github.com/users/williscool/gists{/gist_id}","starred_url":"https://api.github.com/users/williscool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/williscool/subscriptions","organizations_url":"https://api.github.com/users/williscool/orgs","repos_url":"https://api.github.com/users/williscool/repos","events_url":"https://api.github.com/users/williscool/events{/privacy}","received_events_url":"https://api.github.com/users/williscool/received_events","type":"User","site_admin":false},"created_at":"2018-10-15T09:29:37Z","updated_at":"2018-10-15T09:29:37Z","author_association":"NONE","body":"Also happy to update any docs if you point me their way"}}
{"actor":{"display_login":"williscool"}}