How to ensure data integrity during database migration