Safely and automatically migrate database schemas