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 down migration for promotion_orders promotions foreign key #5642

Conversation

rabbitbike
Copy link
Contributor

@rabbitbike rabbitbike commented Feb 6, 2024

Summary

The most recent migration AddPromotionOrderPromotionForeignKey has an incorrect down method.
The remove_foreign_key method has an incorrect "to_table" in the second parameter.

This migration creates a foreign key between spree_orders_promotions and spree_promotions, so the down method should refer to spree_promotions instead of spree_orders.

If you rollback this migration you will be removing the foreign key between spree_orders_promotions and spree_orders.
This causes the rollback of the previous migration to fail with a Table 'spree_orders_promotions' has no foreign key for spree_orders error, as it correctly tries to remove the same foreign key.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@rabbitbike rabbitbike requested a review from a team as a code owner February 6, 2024 06:37
@github-actions github-actions bot added the changelog:solidus_core Changes to the solidus_core gem label Feb 6, 2024
@rabbitbike rabbitbike changed the title Fix migration down method for promotion_orders promotions foreign key Fix down migration for promotion_orders promotions foreign key Feb 6, 2024
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c9b62b1) 88.55% compared to head (69e178f) 88.55%.
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5642   +/-   ##
=======================================
  Coverage   88.55%   88.55%           
=======================================
  Files         685      685           
  Lines       16406    16406           
=======================================
  Hits        14528    14528           
  Misses       1878     1878           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Thank you! ❤️

@kennyadsl kennyadsl added backport-v4.3 Backport this pull-request to v4.3 type:bug Error, flaw or fault labels Feb 6, 2024
@tvdeyen tvdeyen merged commit 628c615 into solidusio:main Feb 8, 2024
18 checks passed
Copy link

github-actions bot commented Feb 8, 2024

💚 All backports created successfully

Status Branch Result
v4.3

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v4.3 Backport this pull-request to v4.3 changelog:solidus_core Changes to the solidus_core gem type:bug Error, flaw or fault
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants