You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Within a ExUnit test, I use an on_exit callback to cleanup the database after testing:
IO.inspect(My.Account |> My.Repo.all) # shows a record
My.Account
|> Ecto.Query.where(my_id: ^my_id)
|> My.Repo.delete_all
IO.inspect(My.Account |> My.Repo.all) # shows []
After testing, I run iex - S mixand then My.Account |> My.Repo.all, which still shows the same record. Is this result to be expected? Why doesn't the record get deleted? Am I missing anything?
My best guess is that the delete does not get synced to disk. If this is the case, is there an idiomatic way to force the sync?
Thanks!
The text was updated successfully, but these errors were encountered:
Are you sure that this is exactly the same account? It could bethat you have different mnesia paths for iex and test environments, so you see two different databases.
Yes, it was. I have now a path for each environment (dev, test, production) and I wipe all tables before the tests. I couldn't solve the original problem, but now I can live with it.
Within a ExUnit test, I use an
on_exit
callback to cleanup the database after testing:After testing, I run
iex - S mix
and thenMy.Account |> My.Repo.all
, which still shows the same record. Is this result to be expected? Why doesn't the record get deleted? Am I missing anything?My best guess is that the delete does not get synced to disk. If this is the case, is there an idiomatic way to force the sync?
Thanks!
The text was updated successfully, but these errors were encountered: