I have a Microsoft SQL Server database project with hundreds of objects (tables, procedures, etc). The resulting database is used in two contexts though -- some customers get a database with all the objects, but some customers' databases contain only a subset of the objects. About 75% of them.
Is there a way to mark each object in the database project in such a way I can say whether it should be deployed or not based on a toggle of some sort?
I thought of a few options:
- Use pre/post deploy scripts. I really don't want to do this, as it defeats a lot of the benefits of using a database project in the first place.
- Install ALL objects, and have a post-deploy step that deletes the objects that we don't want in the "subset" install. Seem hackish to me.
- Break the one database project into two project: one with the required objects and one with the optional.
- Have two projects, one with "all" and one with the subset. 75% of the files will appear in both projects. Then I install the appropriate project's database
I think #3 and #4 sound doable, but I'm still hoping there is a simpler, more maintainable solution.