New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction strategy not configurable per script #207

timhenstridge opened this Issue Aug 3, 2016 · 3 comments


None yet
5 participants
Copy link

timhenstridge commented Aug 3, 2016

I have an issue where I want to run most scripts inside dbup's per script transaction strategy but some SQL statements simply cannot be run inside a transaction such as CREATE FULLTEXT and ALTER DATABASE,

I tried injecting my own ITransactionStrategy but can't seem to set this due to class access and how the library was written, I also looked into dynamically altering the "TransactionMode" to no success. what I really want is a per script setting/rule that says "No Transaction" which can pass along, are there any ideas?

So far my solution to achieve this will be to create 2 upgrade engines one with per script transactions and one with no transactions and run each engine but this will not ensure a single sequential path of updates.


This comment has been minimized.

Copy link

JakeGinnivan commented Aug 14, 2016

I think the only solution is to let the scripts deal with the transaction themselves and set DbUp's transaction mode to no transaction.

Otherwise what would the API look like? Also, if you set a script to no transaction and also said to put a transaction around everything, would you throw when trying to build the engine?

Happy to get a PR if you can come up with a nice way to add this in.


This comment has been minimized.

Copy link

jineshk commented Dec 6, 2016

One work around, that I have used is to

  1. Disable transaction at builder level
  2. Hook into Script preprocessor which is called per script
  3. Wrap sql content (string) in transaction conditionally

Not completely elegant but does the job.

@droyad droyad closed this Feb 26, 2018


This comment has been minimized.

Copy link

rahulpnath commented Dec 18, 2018

Hit the same problem and ended up doing something as suggested above. More details here for anyone interested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment