Skip to content

Conversation

greg-rychlewski
Copy link
Member

Closes elixir-ecto/ecto#4641

There were two options discussed:

  1. Add this option
  2. Don't rollback when analyze: false

I went for the first option for two reasons:

  • The transaction code is shared by any non-standard adapter so trying to make less assumptions about what the correct behaviour should be
  • It's more flexible allowing the user to not roll back if they want to use analyze: true

Copy link
Member

@josevalim josevalim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code wise looks good to me. I wonder if we should call it :transaction or :wrap_in_transaction though, although I am happy to go with what you decide!

@greg-rychlewski
Copy link
Member Author

I like wrap_in_transaction!

@greg-rychlewski greg-rychlewski changed the title Add :rollback option to explain Add :wrap_in_transaction option to explain Jul 21, 2025
@greg-rychlewski greg-rychlewski merged commit 4752ad2 into elixir-ecto:master Jul 21, 2025
20 of 22 checks passed
@greg-rychlewski greg-rychlewski deleted the explain_rollback_opt branch July 21, 2025 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repo.explain doesn't work in transactions
2 participants