1

Before applying a migration in EF Code First, you can ask to see the SQL script it intends to apply with:

PM> update-database -script

Unfortunately this opens a script named something like tmp939D.sql in Visual Studio and then freezes the IDE until it finishes generating the script. If the script is long, this is a long freeze. Is there some way to push this to a file on the hard drive instead of in the IDE? A way to specify the name of the SQL script file it generates?

1 Answer 1

1

See this answer for a solution: https://stackoverflow.com/a/14339379/219187

This solution does NOT use -Script, but takes a C# approach. We implemented it in a unit test, so our build server generates the SQL scripts after every software change.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.