Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Idea] Add unless index_exists? on index creation #82

Closed
ohaddahan opened this issue Jul 11, 2019 · 1 comment
Closed

[Idea] Add unless index_exists? on index creation #82

ohaddahan opened this issue Jul 11, 2019 · 1 comment

Comments

@ohaddahan
Copy link

I recently used this gem to add concurrently an index on a large and busy table on Heroku.

The operation lost connection midway but the migration finished.

Seems like some parts of Rails book keeping failed and now I get failing new builds since it think the migration need to be done but the index exists.

I think that adding unless index_exists? to the recommendation will be useful for future similar issues others may have.

@ankane
Copy link
Owner

ankane commented Jul 12, 2019

Hey @ohaddahan, thanks for the suggestion. I've experienced this as well (and sometimes used the same trick), but I don't want to make it the default recommendation. Sometimes, concurrent indexes fail to build and exist but are invalid. In this case, I think it's better to throw an error so developers can manually resolve the issue (most likely, drop the invalid index and run the migration again).

@ankane ankane closed this as completed Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants