Conversation
eb185fc to
33e94c5
Compare
tuj
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to ticket
https://leantime.itkdev.dk/_#/tickets/showTicket/7131
Description
When importing systems and reports, we currently duplicate inactive items. This is due to
EntityActiveFilterfiltering out all inactive entities and thus the importer does not detect if an inactive items already exists (and creates a duplicate).We resolve this by
As added bonusses we also clean up a bit by
We need to clean up the current data, and one way to do this (and probably also the best and most correct) is to delete all but the first row of any group of duplicated rows (sharing a
sys_internal_id). This can be done by observing that the first row in a group is the one with the lowest ID (AUTO_INCREMENTactually increments values!), and then using the following SQL incantations to clean up:Shout out to https://stackoverflow.com/a/79695983 for coming up with this!