In order to reduce the load on the database, our developers have moved obsolete orders to separate tables for archiving. At the same time, all data was saved: archived orders can be found through a simple search and view all the details of shipment, payment, etc.
In order to automate the archiving of orders, we have developed the following functionality: when an order is, for example, 1 year old (or some other arbitrary time set by the administrator), all order data is transferred to the archive table and this action frees up space for active orders. The action is carried out according to a given schedule using CRON.
A special script checks whether all order properties have been correctly transferred to the archive tables. If there are no errors, the order is removed from the main table. This check prevents data loss during archiving.
If you need to disable archiving for some orders, you can do it manually by editing the order.
We added custom fields to order search. Now orders can be searched not only by status, but also by customer’s phone number, country, VAT, etc.