Tim Abell
Tim Abell

Reputation: 11901

Why would a dacpac fail to update a view on an azure sql server?

We have a sql deploy package, aka dacpac with an altered definition of a sql view.

Is there any reason why the deploy process might fail to alter the existing view? The sql deploy step of the deployment pipeline ran without error as usual so no clues there.

It's only failing to work in our azure pipeline deployment, it works okay running against a local database. It's the first time we've encountered this issue even though we've been using the dacpac for well over a year.

If anyone knows how dacpacs decide what alter statements to issue that would be useful.


Sorry this is a bit vague but we're clutching at straws. We'd ditch the awful dacpac system if we could, but that'll take a bit longer. Obvious answers such as "is it pointing at the right database" welcome as any wild guesses could get us there.

Upvotes: 1

Views: 874

Answers (2)

Tim Abell
Tim Abell

Reputation: 11901

Just keep creating new releases from the same build until one of them deploys correctly.

This should not be the answer because the dacpac is unchanged, but it's what ended up working.

I can only guess this is because the dacpac figures out what changes to make at deploy time by inspecting the database and is therefore fundamentally non-deterministic. Just what you don't want for a system for changing your production database schema.

Upvotes: 0

Venkataraman R
Venkataraman R

Reputation: 12969

Ideally, the view should be altered as part of the DACPAC publish. If it is not happening, it could be because view is mentioned as excluded object.

/p: ExcludeObjectType=(STRING) Views
/p: ExcludeObjectTypes=(STRING) Views;Triggers

Sql Package Publish options

Upvotes: 1

Related Questions