I need a solution for a special scenario:
- Each user has many(millions to billions) database rows of his products. Each row is an product.
- Each user can only change his own products.
- Each subset of those products can be changed differently.
- Each user can change different values(price, amount,...) by changing their value by adding, subtracting a fixed entered value.
- Each user can also change those values by adding or subtracting a percentage value(add 3 % to all selected values or to a subset of all products).
- Each change can be done through executing any amount of changes unless he saves his changes.
- In addition those users need the possibility to roll back their changes to the initial state or to a state he defined any time ago, so he can choose which state he wants to be restored.(like many undo, redo functionalities stored in a state with a timestamp)
- If a user has defined 12 or another amount of changing states and he decides to roll back them in reverse order than he must get all values restored to its initial state.
Based on the massive amount of data for each user it is not really practical to store all changes to each product.
It will be used in a web based application written in PHP, Javascript and MySQL.
Is there any possibility(database functionality, another database, api,...) to realize that? Maybe something like the command pattern in a different way?
I hope someone has an idea how i can realize that.