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

🧹 Marketplace: Split Cart and Order into separate tables #2020

Open
zspencer opened this issue Dec 11, 2023 · 0 comments
Open

🧹 Marketplace: Split Cart and Order into separate tables #2020

zspencer opened this issue Dec 11, 2023 · 0 comments
Assignees
Labels
🧹 refactor Includes non-behavioral changes

Comments

@zspencer
Copy link
Member

Initially, it felt like it made sense to have them on the same table; but there's a lot of reasons why they shouldn't be:

  • Product#price can change when they are in the Cart, but the Order.ordered_products.price should not ever change.
  • Products and DeliveryAreas that have never been in an Order can be destroyed, even if there is a Cart

The easy way to do this would be to duplicate the structure of the tables:

  • marketplace_orders into marketplace_carts and
  • marketplace_ordered_products into marketplace_cart_products tables,
    And then move the Cart model to use the marketplace_carts and the CartProduct model to the marketplace_cart_products. I don't think we need to worry about preserving Cart data at this time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧹 refactor Includes non-behavioral changes
Projects
None yet
Development

No branches or pull requests

2 participants