Matomo DB migration

I have a question regarding upgrading Matomo, we decided to upgrade our version of Matomo from 3.13.3 to 5.0.0. The DevOps team is asking if it is possible to start new clean DB but keep all visits_id and visitor_ids and its links with previous data.
How are visits and visitor links generated in Matomo is the question basically?
Thanks in advance.