I'm running the below sqlpackage
command against my sqlserver
:
sqlpackage /action:Publish /SourceFile:"Database Services\bin\Release\Database Services.dacpac" /TargetConnectionString:"Data Source=${Env};Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False;Initial catalog=${Target}"
It contains one predeploy
script with one alter.
However, I see in the error it tries to alter
the whole DB
(one level up) instead just doing the alter
on the table
. any idea why? does it related to some flags I need to add as mentioned here:
I would recommend using /action:Script
(see here) to see which actions it will perform, most likely this will give you some clue as to which flags should be set/cleared.
-- Edit
According to this old answer you can disable deploying the database properties when designing the .dacpac.
If you want to override this behaviour when publishing the .dacpac, you should probably use the ScriptDatabaseOptions
property - see the whole list of switches here.