Publish to azure - turn off scheme update is terminating because data loss could occur

azure entity-framework entity-framework-6 visual-studio visual-studio-2017

Question

I am using EF6 code first, with automatic migrations disabled. All is fine on my local PC, but when I publish from Visual Studio to Azure I get the error message telling me that the schema update is terminating because data loss might occur.

I know that the changes I'm running will mean that a data loss will occur but that is fine. But I can't find out how to disable this check from running. I have seen posts elsewhere that relate to database projects - but cannot find out how to do it for EF6 code first.

The exact error message is below. Many thanks for your help.

Error SQL72014: .Net SqlClient Data Provider: Msg 50000, Level 16, State 127, Line 10 Rows were detected. The schema update is terminating because data loss might occur.

Error SQL72045: Script execution error.

The executed script:

           FROM   [dbo].[Shift])
    RAISERROR (N'Rows were detected. The schema update is terminating because data loss might occur.', 16, 127)
        WITH NOWAIT;
1
0
2/20/2019 6:46:30 PM

Popular Answer

Got the same error. I am updating my AzureDB from local. I checked the hit box update database at the publish dialog. But u have to do this (delete, rename stuff) force.

I migrating my DB when the application launches:

public Configuration()
{
       AutomaticMigrationsEnabled = true; 
       AutomaticMigrationDataLossAllowed = true; 

       ContextKey = "Vlokk.Api.Models.ApplicationDbContext";
}

And in your deployment settings disable to update your database..

0
3/19/2019 9:53:31 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow