Evolve: Erase fails when functions depend on each other

Sample output:

Evolve initialized.
Executing Erase...
Erase failed. Impossible to erase schema dbo. Cannot DROP FUNCTION 'dbo.FpR' because it is being referenced by object 'FpObscure16'. Sql query: DROP FUNCTION [dbo].[FpR] Cannot DROP FUNCTION 'dbo.FpR' because it is being referenced by object 'FpObscure16'.
Erase failed. Impossible to erase schema dbo. Cannot DROP FUNCTION 'dbo.FpR' because it is being referenced by object 'FpObscure16'. Sql query: DROP FUNCTION [dbo].[FpR] Cannot DROP FUNCTION 'dbo.FpR' because it is being referenced by object 'FpObscure16'.

Evolve Tool version: 2.4.0 SQL Server version: Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64) Sep 24 2019 13:48:23 Copyright © 2019 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Home 10.0 <X64> (Build 15063: )

N.B. both functions are defined WITH SCHEMABINDING.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Git history looks good, thanks very much. Sponsorship should be set up now!

Absolutely, especially since we will be using Evolve for the duration of this client project and most likely for others too!

This is now working - thanks very much! I owe you a coffee if you’re ever in London.

I’ve tried with Flyway, and it also isn’t able to clean the schema. It fails because a check constraint is dependent on a computed column!

Yes, it returns a lot of rows - it looks like the drop didn’t work properly.

I’ve emailed the schema to evolve-db@hotmail.com, I hope that makes it clearer what’s going on here.

Thanks for this! I’ll try with that version and get back to you. It might take a while as the issue is intermittent.