dynamoid icon indicating copy to clipboard operation
dynamoid copied to clipboard

Feature request: Rake task to create/recreate index

Open mooktakim opened this issue 4 years ago • 6 comments

Hi,

The rake task dynamoid:create_tables is helpful for creating all the tables the first time you deploy. But over time I found myself needing to change the schema. I understand a rake task to modify the table would be complicated (risk of losing data). But it would be really handy if there was a rake task to create only index's defined in the model. We would be able to delete and create index without risk of losing data.

mooktakim avatar Jun 02 '20 18:06 mooktakim

Sounds reasonable. I wasn't sure whether table schema migration is useful as far as it's usually changed manually in AWS Console (or maybe with terraform or some similar tool).

I'm wondering what is your use case. Do you need to add indexes in development environment locally or in staging/production?

andrykonchin avatar Jun 02 '20 21:06 andrykonchin

Maybe its not a normal thing to do, but recently i've been creating different index's to get the result i'm looking for. I wish i didn't need to use aws console to make these changes. I have dev and prod environment. Its a lot of work making sure changes are replicated. I haven't used terraform, but thats how people solve this problem. I have a rails project.

mooktakim avatar Jun 02 '20 21:06 mooktakim

I believe it's easy enough just to add a Rake task to update indexes - delete excessive and add missing indexes.

Will add it in the next release (in ~1-2 months).

andrykonchin avatar Jun 02 '20 21:06 andrykonchin

Thats great cheers.

mooktakim avatar Jun 02 '20 21:06 mooktakim

@andrykonchin Is this already being worked on? If not, are you accepting contributions for it? I'd benefit from having this feature on one of my projects, so I'll be happy to help to introduce it directly on Dynamoid

AlexGascon avatar Jul 23 '20 16:07 AlexGascon

This issue is still in the backlog and I haven't started it yet. So contribution is welcome!

andrykonchin avatar Jul 23 '20 16:07 andrykonchin