Richie Lee discusses an alternative to pre-model scripts:
According to the blurb, deployment contributors can perform custom actions when deploying a SQL script. And one such use of deployment contributors would be to alter index builds to be an online operation. Microsoft also have a Github DACExtensions repo, and this is very useful because, and in the interests of full disclosure, I have never written a deployment contributor myself. This is partly because the repo has some very good examples, including the online index issue (this post nicely covers how to make use of deployment contributors.) I know those that have and have explained how they work very well. But I think there are a few challenges w/r/t deployment contributors:
-
No one has ever heard of them
-
You have to use C#
-
They’re not entirely straightforward.
This is a good discussion of deployment contributors, including why we don’t see them more frequently.