Archiving old data

This should be a pretty common requirement, so I am wondering if there's an app for this. To avoid records being piled up in the tables, we were thinking of moving old records to separate tables. But that'd mean I will need to duplicate the entire domain model, with relations, and move old data from "running" (transaction) tables to archive tables, and do the reverse when restoring something from the archieve. How can I do this without duplicating all my tables and writing messy microflows to move records? Is there an app / library function for this? Thanks.
1 answers

What we did was adding an enumeration ‘RecordState’ with the items ‘Active’ and ‘Inactive’. Every table has an before delete microflow with a false as result ( so the record will not be deleted ). In the microflow you can change the RecordState in ‘InActive’ and add a datatime stamp.

And don’t forget to do this also with ‘child’-records and give them the same datetime stamp as the ‘parent’ record.

A separate view is added with all ‘inactive records’, so you can retrieve back the ‘deleted’ record.

One problem, don’t forget to retrieve only ‘Active’ records in Views or dropdown boxes ect. To avoid you can choose ‘Inactive’ records.