Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EF Migrations, Output Text to Nuget Console

When i run migrations to create a database via the Package Manager Console. Is there a way to output text from the Seed method to the NuGet console?

Just the simple create command:

Update-Database -StartupProjectName "Data" -Verbose
like image 462
maxfridbe Avatar asked Mar 28 '12 18:03

maxfridbe


2 Answers

You can execute an SQL PRINT command within the Up() or Down() methods of each individual migration.

base.Sql("PRINT 'I heart kittens';");

This will output 'I heart kittens' to the Package Manager Console window in highlighted yellow text during the 'update-database' process.

like image 83
Dogma Avatar answered Nov 03 '22 13:11

Dogma


I don't think you can output it directly, but you can use tracing and debug commands and attach another instance of VS to see the output.

Taken from this question: Where can I find the console or debug output from code executed in the package manager window?

like image 25
amhed Avatar answered Nov 03 '22 13:11

amhed