efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Migrations: verbose logging to include actual sql

Open esargent opened this issue 10 years ago • 0 comments

When running an update with --verbose I got his message:

C:\code\RevelarPortalSolution\src\RevelarMVC>dnx ef database update --verbose
Finding DbContext classes...
Using context 'ApplicationDbContext'.
Using database 'NewRevelarPortal' on server '(local)'.
Applying migration '20160126184050_practitionerupdates'.
System.Data.SqlClient.SqlException (0x80131904): The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_Distributor_Countries_CountryId". The conflict occurred in database "NewRevelarPortal", table "dbo.Countries", column 'Id'.

Although it isn't much of a leap to figure out in this relatively small migration, it would be even nicer to see the SQL that caused the error, as well as the SQL that occurred before it - which might help me understand if this is just an ordering issue or if I need to do something more drastic to the migration. And in a big migration with many edits it could be even more useful to have that extra info.

esargent avatar Jan 26 '16 18:01 esargent