Add ability to drop & recreate DynamoDB table
See original GitHub issueIs your feature request related to a problem? Please describe.
I’m just getting started with AWS Amplify. I’ve been working through the typical Todo application, when I finally got to the “GraphQL Transform” section in the docs. The first @key
example is for creating a primary key, but the only way that can work with an existing Amplify project is to delete the existing DynamoDB table and update AppSync accordingly. I haven’t found a good way to do this. I’ve had to resort to using amplify api remove
followed by amplify add api
.
Describe the solution you’d like
It’d be helpful, I think, to have something like amplify api recreate
, which would tear down the existing table and recreate it. Since this is all in-development, I’m okay losing the data. And since there’s really no way around recreating the table, I’d have to do this anyway.
I suppose an alternative would be if both tables could be created and Amplify handled the rename so the old table would be archived and the new one would be the active table.
Describe alternatives you’ve considered
I tried renaming the table manually in the AWS Console to avoid a conflict induced by the new schema. Unfortunately, that didn’t work. I think something in either AppSync or CloudFormation needs to be updated as well.
Another potential improvement is to modify the Todo API template to include a key (either primary or secondary) so the user gets sorted todo items out of the box and can be gently introduced to some of the transform DSL.
Additional context
I’d like to emphasize that this isn’t exactly a case about not thinking of my data model up front. I’m really just working through the documentation.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:36
- Comments:27 (3 by maintainers)
A warning with a bold red font should do it. 😃
In first place, you possibly could lock an environment like
amplify env <lock|unlock> prod
If you want to recreate tables I could think of
amplify push --recreate-tables --force
amplify mock --recreate-tables
oramplify mock --rebuild
Regards
Is there any solution/suggestion from either Amplify and/or DynamoDB team on the issue? I’ve run into this issue couple of times and am sure someone else will also run into the same.