-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Remove order association from inventory units #2377
Merged
gmacdougall
merged 12 commits into
solidusio:master
from
mamhoff:remove-order-association-from-inventory-units
Nov 22, 2017
Merged
Remove order association from inventory units #2377
gmacdougall
merged 12 commits into
solidusio:master
from
mamhoff:remove-order-association-from-inventory-units
Nov 22, 2017
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Inventory units link line items to shipments. Both of these have an order. Let's make this a has_many association, through :shipments, which are required. This made a number of changes in the codebase necessary, such as checking for order instead of order id identity.
We do not need this column as the same data is represented by the `order_id` column on the `spree_shipments` table. I needed to change some stubbing in the manifest spec.
This method would be lost by the removal of the DB column. Alternatively, we could call `order.id`, but that would in many cases unnecessarily instantiate more objects, so I opt for an explicit delegate.
This spec was quite brittle as everything was stubbed. This is a minimal fix, I still do not regard this a well-working spec.
This shipment in this spec was not associated to the same order, which is unrealistic. Fixed by adding the necessary association.
cbrunsdon
approved these changes
Nov 22, 2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for continually trying to get this merged. Good by me, 👍. I think its a positive step forward.
gmacdougall
approved these changes
Nov 22, 2017
kennyadsl
added a commit
to solidusio-contrib/solidus_expedited_exchanges
that referenced
this pull request
May 2, 2018
order_id column has been removed from solidus since solidusio/solidus#2377. Now the order reference will be taken from the shipment in which the inventory units are included.
kennyadsl
added a commit
to solidusio-contrib/solidus_expedited_exchanges
that referenced
this pull request
May 3, 2018
order_id column has been removed from solidus since solidusio/solidus#2377. Now the order reference will be taken from the shipment in which the inventory units are included.
kennyadsl
added a commit
to solidusio-contrib/solidus_expedited_exchanges
that referenced
this pull request
May 3, 2018
order_id column has been removed from solidus since solidusio/solidus#2377. Now the order reference will be taken from the shipment in which the inventory units are included.
kennyadsl
added a commit
to solidusio-contrib/solidus_expedited_exchanges
that referenced
this pull request
May 3, 2018
order_id column has been removed from solidus since solidusio/solidus#2377. Now the order reference will be taken from the shipment in which the inventory units are included.
kennyadsl
added a commit
to solidusio-contrib/solidus_expedited_exchanges
that referenced
this pull request
May 3, 2018
order_id column has been removed from solidus since solidusio/solidus#2377. Now the order reference will be taken from the shipment in which the inventory units are included.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the fourth attempt to remove the
order_id
column from thespree_inventory_units
table. It is redundant, as Inventory Units are associated with Shipments, which also have an order ID.This will slow down some operations, as we're removing what is essentially a cache column from inventory units. It will also speed up some operation, as we are getting rid of a column with an indexes.
Most importantly, this simplifies our data model.
Compared to the previous attempts, this is simplified since work on the stock system has removed the necessity for packages and packers to be initialized with orders.
Previous related PRs: #1770 , #2124, #2125, #2256.