Handle outdated aliases for placeholder contributions
In a discussion on #467522 (closed) we came across a potential issue where a model gets renamed, and then a new model gets created with the same name as the previous model.
Say
Notegets renamed toDescription. A long time later, a new developer decides to create a new model namedNotewhich is also linked to the user (this new model has nothing to do with the oldNotemodel which was renamed long ago).The issue is now we have some old records in the DB where the
modelcolumn hasNotewhich should be mapped toDescription, but we also have some new records for the newNotewhich should not be mapped.We have no way of telling which
Noterecords are what we now callDescriptionand which are the newNotetype.
One of the proposed solutions to this was to add a new gitlab_version column so we know which version of an alias is being used. However, this can still cause some issues since on GitLab.com we could have a change part way through a milestone, meaning 17.2 includes 2 different versions of an alias.
The other solution was a multi stage deployment process which included migrating old data. However, this could end up being more complicated since different installments could deploy upgrades at different times.