microsoft / microsoft/DacFx

ScriptDatabaseCompatibility parameter silently ignored when ScriptDatabaseOptions = false

Open
#506 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
C#
Stars
460
Forks
29
Avg merge
4d 9h
Merged PRs (30d)
7

Description

- SqlPackage or DacFx Version: SqlPackage 62.4.92
- .NET Framework (Windows-only) or .NET Core: .NET Core
- Environment (local platform and source/target platforms):
- Local platform: Windows 11
- Source platform: DACPAC built from database project in Visual Studio 2022 v17.11.3
- Target platform: Azure SQL Database and SQL Server LocalDB 16.0.1000.6

**Steps to Reproduce:**

1. Create and build a database project with Compatibility Level 140 and a Target Platform of either "Microsoft Azure SQL Database" or "SQL Server 2022 or Microsoft Azure SQL Managed Instance"
2. Publish the DACPAC with `ScriptDatabaseOptions=false` and `ScriptDatabaseCompatibility=true`

`sqlpackage /Action:Publish /SourceFile:"C:\TeamCity\repos\ScriptDatabaseCompatibilityTest\bin\Debug\Database.dacpac" /TargetConnectionString:"Data Source=(localdb)\mssqllocaldb;Integrated Security=true;Initial Catalog=testdb" /p:ScriptDatabaseCompatibility=true /p:ScriptDatabaseOptions:false`

**Expected Result:**

Either:

1) Database has the compatibility level specified in the database project/DACPAC applied to it. (i.e. the compatibility level is scripted but not other database options)

or

2) A warning or error at runtime that the specified deployment options are incompatible with each other.
3) The documentation for the ScriptDatabaseCompatibility parameter notes this dependency.

**Actual Result:**

New database: Database is created with the default compatibility level, with no error or warning at runtime and no note in the documentation.

Existing database: Database compatibility level is unchanged, with no error or warning at runtime and no note in the documentation.

**Did this occur in prior versions? If not - which version(s) did it work in?**
This is our first time trying to use this functionality.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided SqlPackage publish command against the listed Azure SQL or LocalDB targets, using the DACPAC with compatibility level 140. Trace how ScriptDatabaseOptions and ScriptDatabaseCompatibility are handled, then verify that the compatibility setting is applied or that an incompatibility is reported and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, sql
Domain
databases, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.