SONAR-926 improve performance of db migrations 490 and 497