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

Change migration name to avoid conflicts #7526

Merged
merged 1 commit into from
Aug 25, 2016

Conversation

arpitchauhan
Copy link
Contributor

The migration AddMissingIndexes conflicts with a migration of similar
name in other gems, eg acts_as_taggable_on 4.0.0. Its name has been
made more specific in order to avoid such conflicts while installing
migrations in a rails app using

bundle exec rake railties:install:migrations

@krzysiek1507
Copy link
Contributor

Hi @arpitchauhan could you please rebase branch and create PR for master too?

@arpitchauhan
Copy link
Contributor Author

arpitchauhan commented Aug 12, 2016

@krzysiek1507 Rebasing is proving quite complicated (many conflicts). Is it ok if I cherry-pick my commit onto a new branch made out of master?

@krzysiek1507
Copy link
Contributor

@arpitchauhan sorry. I mean, rebase your branch with 3-1-stable and also create new PR to master with cherry-picked commits. ;) I hope now it's clear.

@arpitchauhan
Copy link
Contributor Author

Sure, will do.
On Fri, Aug 12, 2016 at 10:12 PM Krzysztof Rybka notifications@github.com
wrote:

@arpitchauhan https://github.com/arpitchauhan sorry. I mean, rebase
your branch with 3-1-stable and also create new PR to master with
cherry-picked commits. ;) I hope now it's clear.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#7526 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ACQnT9dv5jh7twoVJfeQ66ctUMM-C996ks5qfKKLgaJpZM4Ji7lu
.

@arpitchauhan
Copy link
Contributor Author

@krzysiek1507 Done. The other PR is #7530

@krzysiek1507
Copy link
Contributor

Hi @arpitchauhan could you add checking if indexes exist?

@arpitchauhan
Copy link
Contributor Author

@krzysiek1507 do you mean adding spec examples (tests)?

@krzysiek1507
Copy link
Contributor

@arpitchauhan I mean this. Because migration's name is changed, it will be copied and run, so this will cause problems.

@arpitchauhan
Copy link
Contributor Author

@krzysiek1507 Ah, got you. Will add them.

unless index_exists?(:spree_option_values_variants, [:option_value_id, :variant_id])
add_index :spree_option_values_variants,
[:option_value_id, :variant_id],
name: 'index_option_values_variants_on_option_value_and_variant'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.

@arpitchauhan arpitchauhan force-pushed the bugfix/migration-name branch 2 times, most recently from 8b84bdc to 4e011a2 Compare August 15, 2016 11:58
@arpitchauhan
Copy link
Contributor Author

@krzysiek1507 done

@krzysiek1507
Copy link
Contributor

@arpitchauhan could you squash commits please?

@arpitchauhan
Copy link
Contributor Author

@krzysiek1507 done

class AddMissingIndexesOnSpreeTables < ActiveRecord::Migration
def change
unless index_exists?(:spree_promotion_rules_users, [:user_id, :promotion_rule_id])
add_index :spree_promotion_rules_users,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we consider index name in index_exists?? And please fix indentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krzysiek1507 The documentation says we need to use table name and column name(s) as arguments.

I'll fix the spacing between add_index and arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arpitchauhan Yes, but we can put name into options hash (4th example).
If you check source, you will see that name will be consider too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krzysiek1507 got it, thanks. Done.

@arpitchauhan arpitchauhan force-pushed the bugfix/migration-name branch 3 times, most recently from 1e1f0ff to f5b1910 Compare August 16, 2016 10:45
The migration AddMissingIndexes conflicts with a migration of
similar name with other gems, eg acts_as_taggable_on 4.0.0. Its name has
been made more specific in order to avoid such conflicts while
installing migrations in a rails app.

Also, since the migration will be copied over and run again, checks have
been inserted ensuring the indexes being added don't exist already.
@arpitchauhan
Copy link
Contributor Author

@krzysiek1507 is it possible for this PR to be included in 3.1.2?

@arpitchauhan
Copy link
Contributor Author

@damianlegawiec Similar MR for master branch was merged ( #7530 ). Can this be merged too?

@damianlegawiec damianlegawiec merged commit 26110a7 into spree:3-1-stable Aug 25, 2016
@damianlegawiec
Copy link
Member

Sure @arpitchauhan and thanks for the fix!

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

5 participants