Open tjma2001 opened 3 months ago
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?
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?
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 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.
Hey @tjma2001, Thank you for bringing this up. I was able to replicate the issue in the sandbox environment but not in production. This is expected behavior in the sandbox to minimize deployment time. However, Iโll flag this as a feature request for the team to explore options for retaining data during sandbox deployments.
+1 for this feature. I don't want to seed the data every time we make changes to the schema ๐ฅ (And this freaked me out so I didn't even dare to test on production ๐ข)
I agree - this is very surprising behavior but glad that it only affects the sandbox. Is it possible to document this somewhere?
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
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