Dynamoid / dynamoid

Ruby ORM for Amazon's DynamoDB.
MIT License
580 stars 195 forks source link

Update GSI the existing table #635

Closed ninhlv-9984 closed 1 year ago

ninhlv-9984 commented 1 year ago

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?

andrykonchin commented 1 year ago

Hello. No, Dynamoid doesn't support table schema management (like mentioned GSI creation).

Wondering what is a use case for such feature.

ninhlv-9984 commented 1 year ago

@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.

andrykonchin commented 1 year ago

I suppose you are talking about something similar to Rails migrations and

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)?