-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On adding a secondary index, my data gets dropped from my table #2795
Comments
Hi @tjma2001, thanks for raising this issue 👋 This sounds like expected behavior though. By default, in sandbox environments, destructive updates are allowed on the API resources. This is not the case in production environments. Are you observing this in a sandbox or production environment? |
I am observing this in sandbox environment. I haven't tried doing this on production yet. Perhaps I can spin up a dummy table, add some data, add the GSI and see what the effect is. I have not seen this behaviour in a sandbox environment which is why I opened up the ticket. Could this be because it takes quite a while to create a GSI on a table that already exists? |
I just performed a test in production.
thanks for the assist. |
The other thing to note is that it significantly increases your deployment time. I would suggest only adding one GSI per deployment unless these updates are performed in parallel. |
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
DataStore
Amplify Version
v6
Amplify Categories
storage
Backend
Amplify Gen 2 (Preview)
Environment information
Describe the bug
When I add a global secondary index to a model,
.secondaryIndexes((index) => [index('apiKey').sortKeys(['dateStamp'])]),
, it drops all that data from my dynamodb tables.Expected behavior
I expect it to work, the same way, that adding or removing fields from a model should work. I know if I add a GSI on the AWS web interface, that it will not drop my data at all.
Reproduction steps
Code Snippet
// Put your code below this line.
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: