Notifications warning in migration
I'm getting a warning
[warning] Missed 1 notifications in action GF.WebComponents.WebSite.update
in the logs when running a new migration that calls an :update
action on a resource. I know very little about Ash notifications and how they work. I don't want to disable them globally, because they might be useful in the future. How can I prevent this warning from appearing when the migration runs?
10 Replies
Are you using Ash actions in your ecto migration code?
In general, that can cause problems further down the road as you change your resources. I'd typically suggest using raw ecto queries against tables to do that kind of thing.
I'm calling an Ash action from my ecto migration.
Regardless, you can silence notifications for specific invocations w/
return_notifications?: true
and handling them yourself IIRCMost of the logic in the migration is adding records, using Ash resources, and Ash changesets.
I would have to redefine several Ash resources into Ecto resources to avoid using Ash
that will affect the return shape, i.e
{:ok, result, _} = Api.create(..., return_notifications?: true)
Okay, got it! I was adding
return_notifications?: true
to the Changeset.for_update()
function. Adding it to API.update()
makes sense.All Ash resources are ecto schemas FWIW. And what I generally do is avoid usage of any app level thing for data migrations. i.e
But if its just a one time migration you need to happen in prod, that you're going to remove later then it really doesn't matter.
or at least, that you can remove later
Doing raw INSERTs would be very difficult, because the record has multiple levels of nested, embedded values. The
return_notifications?: true
option seems like the best route for this.
Or, not doing it in a migration is an option too.Its all tradeoffs, so I feel you 🙂 mostly just wanted to let you know that it could present an issue in the future.
Sounds good. Thanks @Zach Daniel !