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

Fix adding/removing field's index when generating migration #5522

Conversation

travisjeffery
Copy link

When trying to generate a migration that removes a field with an index,
the up migration will remove both the field and the index, and the down
will re-add both the field and the index.

Also improved the indentation formatting of the generated migration.

I believe the existing functionality is not tested, so I'll add tests too.

Thanks,

Travis

@josevalim
Copy link
Contributor

Removing the field automatically removes the index, so we should skip the
index part if we are removing the field, no? And yes, please add tests. :)

When generating a migration that removes a field with an index, the down
will add both the field and its index.
@travisjeffery
Copy link
Author

Done!

josevalim added a commit that referenced this pull request Mar 21, 2012
…dding_removing_index

Fix adding/removing field's index when generating migration
@josevalim josevalim merged commit 2884567 into rails:master Mar 21, 2012
mhfs added a commit to mhfs/rails that referenced this pull request Mar 21, 2012
drogus added a commit that referenced this pull request Mar 22, 2012
Port of #5522 'Fix adding/removing field's index when generating migration'
greggroth pushed a commit to greggroth/rails that referenced this pull request Mar 26, 2012
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

Successfully merging this pull request may close these issues.

None yet

2 participants