Generate Smart Defaults, when Applicable, using SQL Management Studio

7.3k views Asked by At

I am currently working on a project to publish our database as a data tier application. The database is fairly complex and has required several parameters to be modified when either using SQLPackage.exe or publishing via Visual Studio.

One of the scenarios that is currently preventing me from setting my item to done is:

We have a non-nullable column being added to a table, we apply "SmartDefaults, when applicable" as true when publishing the dacpac to allow the dacpac to complete, this is working great.

What isn't working is:

When using the Upgrade Data-tier Application in SQL Management Studio. It doesn't allow me to specify the same option, which prevents the database from being upgraded correctly.

Has anyone been able to do this?

2

There are 2 answers

0
Dwain Browne On

You can add a paramater to the DACPAC /p:GenerateSmartDefaults=true if you're using a CI/CD tool like Azure DevOps

Azure Dev Ops Release - SQL Databse Deployment

If you're doing a right click publish database, then you can select the option under "Generate Script"

Select: Generate Script Option

Select: Generate Smart Default, when applicable