Implemented migration algorithm with new concept: Only apply migrations not already applied.