D
D
drboboev2019-03-20 11:30:37
Database design
drboboev, 2019-03-20 11:30:37

How to build a tree with the preservation of remote branches?

You need to build a tree that changes frequently. And I made such a tree using the Nested Set method. But the problem arose when I realized that the old branches of the tree needed to be preserved. Those. if I delete a branch or an individual item, it shouldn't be permanently deleted. There should just be a note about its removal. And when I request a tree, as of a month or a year earlier, the tree that was as of that period should be loaded.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
d-stream, 2019-03-20
@d-stream

AND?
Another column in the is_deleted table and, accordingly, in the right places in where is_deleted=0
....
upd, more precisely nullable delete_date is better right away - and in the conditions accordingly (delete_date is null or delete_date <= threshold_date)

K
Konstantin Tsvetkov, 2019-03-20
@tsklab

You can make versioning of one line (there is a lot of this on the network). And for tree versioning, you need to make a copy of the entire structure or block subordination changes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question