{"action":"closed","issue":{"url":"https://api.github.com/repos/aws-amplify/amplify-cli/issues/2712","repository_url":"https://api.github.com/repos/aws-amplify/amplify-cli","labels_url":"https://api.github.com/repos/aws-amplify/amplify-cli/issues/2712/labels{/name}","comments_url":"https://api.github.com/repos/aws-amplify/amplify-cli/issues/2712/comments","events_url":"https://api.github.com/repos/aws-amplify/amplify-cli/issues/2712/events","html_url":"https://github.com/aws-amplify/amplify-cli/issues/2712","id":520733677,"node_id":"MDU6SXNzdWU1MjA3MzM2Nzc=","number":2712,"title":"After adding GSI via @key, previous data not displaying in @key query","user":{"login":"blairtaylor","id":29442183,"node_id":"MDQ6VXNlcjI5NDQyMTgz","avatar_url":"https://avatars0.githubusercontent.com/u/29442183?v=4","gravatar_id":"","url":"https://api.github.com/users/blairtaylor","html_url":"https://github.com/blairtaylor","followers_url":"https://api.github.com/users/blairtaylor/followers","following_url":"https://api.github.com/users/blairtaylor/following{/other_user}","gists_url":"https://api.github.com/users/blairtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/blairtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blairtaylor/subscriptions","organizations_url":"https://api.github.com/users/blairtaylor/orgs","repos_url":"https://api.github.com/users/blairtaylor/repos","events_url":"https://api.github.com/users/blairtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/blairtaylor/received_events","type":"User","site_admin":false},"labels":[{"id":1663826011,"node_id":"MDU6TGFiZWwxNjYzODI2MDEx","url":"https://api.github.com/repos/aws-amplify/amplify-cli/labels/@key","name":"@key","color":"c2e0c6","default":false},{"id":1037299867,"node_id":"MDU6TGFiZWwxMDM3Mjk5ODY3","url":"https://api.github.com/repos/aws-amplify/amplify-cli/labels/graphql-transformer","name":"graphql-transformer","color":"fbca04","default":false},{"id":1033398260,"node_id":"MDU6TGFiZWwxMDMzMzk4MjYw","url":"https://api.github.com/repos/aws-amplify/amplify-cli/labels/question","name":"question","color":"d876e3","default":true}],"state":"closed","locked":false,"assignee":{"login":"attilah","id":230432,"node_id":"MDQ6VXNlcjIzMDQzMg==","avatar_url":"https://avatars2.githubusercontent.com/u/230432?v=4","gravatar_id":"","url":"https://api.github.com/users/attilah","html_url":"https://github.com/attilah","followers_url":"https://api.github.com/users/attilah/followers","following_url":"https://api.github.com/users/attilah/following{/other_user}","gists_url":"https://api.github.com/users/attilah/gists{/gist_id}","starred_url":"https://api.github.com/users/attilah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/attilah/subscriptions","organizations_url":"https://api.github.com/users/attilah/orgs","repos_url":"https://api.github.com/users/attilah/repos","events_url":"https://api.github.com/users/attilah/events{/privacy}","received_events_url":"https://api.github.com/users/attilah/received_events","type":"User","site_admin":false},"assignees":[{"login":"attilah","id":230432,"node_id":"MDQ6VXNlcjIzMDQzMg==","avatar_url":"https://avatars2.githubusercontent.com/u/230432?v=4","gravatar_id":"","url":"https://api.github.com/users/attilah","html_url":"https://github.com/attilah","followers_url":"https://api.github.com/users/attilah/followers","following_url":"https://api.github.com/users/attilah/following{/other_user}","gists_url":"https://api.github.com/users/attilah/gists{/gist_id}","starred_url":"https://api.github.com/users/attilah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/attilah/subscriptions","organizations_url":"https://api.github.com/users/attilah/orgs","repos_url":"https://api.github.com/users/attilah/repos","events_url":"https://api.github.com/users/attilah/events{/privacy}","received_events_url":"https://api.github.com/users/attilah/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2019-11-11T04:28:52Z","updated_at":"2019-11-11T10:32:46Z","closed_at":"2019-11-11T10:32:46Z","author_association":"NONE","body":"We have a type in our schema ServiceType. After some initial use by customers, we made an enhancement to add a Category field and needed to sort by category. To achieve this we added the field as well as a @key which generated a GSI. @key for reference was:\r\n\r\n  @key(\r\n    name: \"ByCompanySortedByCategoryNameName\"\r\n    fields: [\"companyId\", \"categoryName\", \"name\"]\r\n    queryField: \"serviceTypeByCompany\"\r\n  )\r\n\r\nThis all has worked well expect for one thing. The original service type data was not migrated over to the GSI. When we called serviceTypeByCompany the query initially returned no values. Once we repopulated the data, the values displayed and all is well. Unfortunately this will be a pretty major issue going forward - introducing a GSI for a type which had a significant number of existing rows.\r\n\r\nIn researching, we came across this question which seems to ask about the same issue.\r\n\r\nhttps://stackoverflow.com/questions/50311154/does-creating-dynamodb-gsi-on-existing-table-indexes-old-records\r\n\r\nThe response is that a new DynamoDB GSI does index old records. That was not our experience. \r\n\r\nIs there a way to preserve access to old records when introducing a new @key / GSI in AWS Amplify using DynamoDB? In our case is there a way to default the values for a new field and if so, would this have migrated the older records to the GSI?\r\n"}}
{"actor":{"display_login":"attilah"}}