convene icon indicating copy to clipboard operation
convene copied to clipboard

🧹 `Marketplace`: Split `Cart` and `Order` into separate tables

Open zspencer opened this issue 1 year ago • 0 comments

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.

zspencer avatar Dec 11 '23 21:12 zspencer