ITADN

automatically merge hits from codebase with db on server launch

#35OpenTimtam 创建于 2025-08-01
enhancement
T
Timtamcommented
## Summary a mechanism that reads all hits built into the codebase when starting the server and does the following: - every hit that is new to the server will be added to the db * if the yt id is unknown, we'll add it new to the server * if the yt id is already in use because it was accidentally created by the admin of the server (custom = false), we'll override it with our version (codebase always takes priority) - to do that, store all linked packs from said hit, delete it and all its pack links, then create our version and relink all packs that the user linked to before - if the hit (compared by hit_id) was created by an earlier launch (custom = true) and the last_modified is older, we'll update it with the current data - every hit that is already in the db but differs from the codebase version needs proper treatment: * is the last edited time in the codebase newer than the one in the db, override it. the version in the db is probably from an earlier import from the codebase version, which got edited in the meantime * if the last edited date in the db is newer than the one in the codebase, we'll not update it (we don't want to roll back changes that haven't been merged back into the codebase yet) - all custom = true hits in the db that no longer exist within the codebase will be dropped ### Motivation Now that we figured out a suitable database scheme in #34, this change needs to make sure to properly merge the codebase on server launch, taking the user-created hits into consideration as well as removing dropped and adding new hits in the process.
0 条评论