microsoft / DacFx

SQL Server database schema validation, deployment, and upgrade runtime. Enables declarative database development and database portability across SQL Server versions and environments.
https://aka.ms/sqlpackage-ref
MIT License
292 stars 15 forks source link

Incorrect deployment plan order generated when there is circular reference between column dropped and column referenced by function #413

Open abhikum opened 4 months ago

abhikum commented 4 months ago

Steps to Reproduce:

  1. Create object with below dependencies:
    • Table t1 has a computed column c1
    • c1 depends on Function F1
    • F1 refers to computed column c2 of Table t2
    • c2 depends on Function F2
  2. Drop the computed column c1

Actual: Error is encountered during function recreation as column dropped is not yet created and referenced by function is not available. This happens because all the create functions and rebind columns are grouped together and this causes some columns which were dropped unavailable during function creation.

Expected: Function and dependent dropped columns should be created in pair so that dependency chain is maintained during Create Function and Rebind column steps.

Did this occur in prior versions? If not - which version(s) did it work in?

(DacFx/SqlPackage/SSMS/Azure Data Studio)