Tell me how best to store history in the database? Suppose there is a table of Products, and this table is related to all sorts of orders and so on. After some time, the company is no longer going to release any product and something needs to be done with it so that it is not displayed anywhere, but the data is the need could be obtained (for example, revenue for this product, orders, and tn).
What is the best way to deal with such records? I have an idea to mark them with a special feature IsDeleted and do filtering on it, then it will not appear and it will be possible to get information if necessary. How correct is this approach?
And another such question: Suppose a product can have 1 of 5 types. On the one hand, I can list them in CHECK, and on the other, I can create a separate entity under types. Which option is more correct?