As we all know OpenCart sent the orders that weren't finalized or orders without a confirmed payment in"missing orders" with "order status id = 0".
Now in my store, I have a massive number of these orders that stacked up in the past few years and these unnecessary rows made my site's database a mess.
Now I want to delete these rows from flowing tables but except for a few related tables, others don't have order status id = 0 to use as reference, the only data that they all have is order id and I made this code for SQL to use for this purpose.
Code: Select all
DELETE FROM OC_Order WHERE order_id='number';
DELETE FROM OC_Order_history WHERE order_id='number';
DELETE FROM OC_Order_option WHERE order_id='number';
DELETE FROM OC_Order_product WHERE order_id='number';
DELETE FROM OC_Order_total WHERE order_id='number';
Now I have two questions: do you guys have a better solution?
And Will this code work safely or I will run into a problem?
Thank everyone