Open PsychicPlatypus opened 2 weeks ago
As long as the function does not throw an exception, everything is fine. Maybe you need to change your migration code to crash if the expected result is not returned:
:ok = Mongo.create_indexes(...)
Keep in mind a migration can also update existing documents. If the query is wrong, then the server won't return an error. In this case, you need to check if the modified_count
attribute returned by the update_many
function contains the expected number of updates.
Description
I tried making a migration for my project, so I did:
And then in the Generated file I wrote my migration code, but I accidentally made an error in the code:
But even though there was an error in the migration, the task just said something like:
When running the migration manually via the
iex
session I actually get the correct error:Expected Behaviour
The
mix mongo.migrate
task should at least log any errors that happen and stop running further migrations, because i can imagine this causing some major issues if I didn't check the migration first.