Update GSI the existing table
ninhlv-9984 opened this issue · 3 comments
I have a model and a table has been created before. After that, I added the new GSI, how can I update the existing table with the new GSI added from the code? Is there any command or method from dynamoid?
Hello. No, Dynamoid doesn't support table schema management (like mentioned GSI creation).
Wondering what is a use case for such feature.
@andrykonchin
Thank you for your response and apologies for the confusion in my previous response. You are correct that Dynamoid does not support table schema management and creating GSIs through migrations. Instead, you would need to create the GSI using AWS CLI, AWS SDK, or the DynamoDB console.
Regarding your question about use cases for managing table schema through code, one use case would be to automate the creation and modification of tables and indexes across multiple environments, such as development, staging, and production. By defining the table schema and indexes in code, you can ensure consistency across environments and reduce the risk of human error in creating or modifying tables and indexes.
I suppose you are talking about something similar to Rails migrations and
- defining schema in a separate file (like
db/schema.rb
) - dumping/loading schema
- modifying existing tables with migrations (defined in
db/migrate
)
Or do you mean some standalone tool not related to Rails approach that can be used even apart from Dynamoid?
Or you mean using schema definition (hash/range keys, GSI and LSI) given in model to migrate table schemas in current environment (staging/test/production)?