microsoft / DacFx

DacFx, SqlPackage, and other SQL development libraries enable declarative database development and database portability across SQL versions and environments. Share feedback here on dacpacs, bacpacs, and SQL projects.
https://aka.ms/sqlpackage-ref
MIT License
356 stars 20 forks source link

ScriptDatabaseCompatibility parameter silently ignored when ScriptDatabaseOptions = false #506

Open HamsterExAstris opened 1 month ago

HamsterExAstris commented 1 month ago

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.