Fixing database migration issues