Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I do a dry run of Update-Database in EF 6?

I am wondering if there is a way to run Update-Database from the Package Manager Console with something similar to the Rails --dry-run flag, in order to see what will be run before doing it. My googling has led to no corresponding command for EF.

Is there one? Is there a hack to do essentially the same thing?

like image 747
Andy Raddatz Avatar asked Jun 01 '15 20:06

Andy Raddatz


1 Answers

You could use Update-Database with a -Script flag to generate a SQL script instead of applying the migration. If you don't specify a source migration, it will use the current database state as the starting point, so you can use the file to verify what would have been executed on the database.

https://msdn.microsoft.com/en-us/data/jj591621.aspx#script

like image 74
jjj Avatar answered Oct 02 '22 23:10

jjj