Ensuring database is migrated and consistent (I hope)