28 Dec 2012, 11:22
Generic-user-small

Marcos Martin (2 posts)

If we add two products to cart, then we create a row for table “cart” and two row for table “line_items”. What happens if now we close our Web Explorer? happens that never is deleted this row for table “cart” and the two rows for table “line_items” . If many people do this, our data base will be full with trash in tables “cart” and “line_items” . This is not a problem if we complete a order because we can delete this order.

How we could solve this problem automaticaly?

09 Jan 2013, 23:54
Generic-user-small

Marcos Martin (2 posts)

I propose

1)Clean to line_items: DELETE FROM line_items WHERE order_id=null

2)Clean to carts: DELETE FROM carts WHERE id NOT IN (SELECT car_id FROM line_items);

Where I must it insert it? For example when somebody make a order? Any other ideas?

  You must be logged in to comment