BeanieODM / beanie

Asynchronous Python ODM for MongoDB
http://beanie-odm.dev/
Apache License 2.0
1.91k stars 201 forks source link

Update migration command to enable/disable transactions #828

Closed mmabrouk closed 5 months ago

mmabrouk commented 6 months ago

This is a modified version of Beanie that includes an option to enable or disable transactions during migrations. Please see the motivation here (https://github.com/roman-right/beanie/discussions/827). To run a migration without a transaction, use the following command:

beanie migrate --no-use-transaction -uri 'mongodb://username:password@localhost' -db 'db' -p .

Please let me know if you'd like this feature in the upstream, and whether you require any changes to the PR. I will ensure to squash the commits and tidy things up.

roman-right commented 6 months ago

Hi @mmabrouk , Thank you for the PR! It is useful. Could you please add a test for this? To guarantee that everything works as expected after future changes.

mmabrouk commented 6 months ago

@roman-right I added a simple test. The perfect way to do it would be to add a separate mongodb service (through an action) without replica. But honestly, that would be an overkill.

mmabrouk commented 5 months ago

@roman-right Do you have feedback on this?

roman-right commented 5 months ago

Hi @mmabrouk , Thank you for the provided test suite. Yes, this is enough. I'll double check everything this week and will merge then. Thank you for the work!

roman-right commented 5 months ago

Hi @mmabrouk ,

Thank you for your work! Merged. It will be published in the next 2 days