Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autorun ELMAH database scripts

I want to use ELMAH with sql server on my ASP.net MVC 3 project, along with EF 4.3.

Is there a way I can have the sql script run automatically that creates the elmah tables?

I'm guessing that ef migrations might do the job but I haven't used them much yet.

I'm aiming for a solution where you can checkout the solution and run it straight up (to sqlexpress locally or full blown sql server on deploy) and have it just work without having to manually run the various helper sql scripts

like image 237
Daniel Powell Avatar asked Feb 14 '12 11:02

Daniel Powell


1 Answers

Add an empty code-based migration (just type add-migration ElmahSetup when there are no pending DB changes).

Then add calls to Sql() to run the elmah in the Up() method. To make the solution complete you have to add corresponding drop statements to the Down() method.

like image 58
Anders Abel Avatar answered Sep 28 '22 09:09

Anders Abel