Pre and Post Deployment scripts and use of XACT_ABORT = ON
However, I think the scope of XACT_ABORT being set to ON should only apply to scripts documented as being used in a transaction (migrations, programmable objects, and additional scripts), and NOT those documented as NOT being used in a transaction (pre and post-deployment scripts).
The currently generated output sets XACT_ABORT ON at the very beginning of the script, and it stays on for everything, including Pre-Deployment and Post-Deployment scripts. As far as I know, there's no way to set Custom transaction handling in a pre or post deployment script since there's no metadata. I tried adding
-- <TransactionHandling="Custom" />at the top and it did nothing.
This is problematic if I want to do certain things in post deployment scripts, such as
which fails if XACT_ABORT = ON becuase it relies on handling its own transaction errors appropriately, and if it can't, it fails with some confusing error messages that the caller likely was never intended to see in the first place.
As a workaround, I can turnit off myself for the post deployment script (which is what I've done), but I don't feel like I should need to.
I would argue that things documented as not being transactionalized (pre/post-deployment scripts) shouldn't have their transaction behavior changed from the default, which is OFF for XACT_ABORT.
Is there some rationale for having this on for everything, not just what ReadyRoll handles within transactions, or is this just an oversight?
Is there some custom control of this for post deployment scripts that I'm not aware of?