I have all my first ef codes in a separate assembly called Migrations
In the package manager console, enter Add-Migration xyz , which evens the migration
Can this be done outside the visual studio? I use rake scripts to do a lot of automation for my build, but this is one of those parts that I haven't received yet. The goal here would be to:
rake db:add_migration "xyz"
This will lead to the execution of some command and the addition of migration to the specified project. This is the only bit that I have not yet been able to figure out how to automate! I would probably create other tasks along with this, like deleting and creating a database and getting migration to a script, so it could be run under my round migrations.
Related material
Add-Migration [-Name] <String> [-Force] [-ProjectName <String>] [-StartUpProjectName <String>] [-ConfigurationTypeName <String>] [-ConnectionStringName <String>] [-IgnoreChanges] [<CommonParameters>]
Command Reference
I see that EF is installed in the packages folder from nuget
packages\EntityFramework.5.0.0\tools
And I can see in the EntityFramework.psm1 file
function Add-Migration { [CmdletBinding(DefaultParameterSetName = 'ConnectionStringName')] param ( [parameter(Position = 0, .... }
But I'm not sure how to execute it from the command line. I tried
..\packages\EntityFramework.5.0.0\tools>powershell EntityFramework.psm1 Add-Migration
but this leads to an error
The term 'EntityFramework.psm1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:21 + EntityFramework.psm1 <<<< Add-Migration + CategoryInfo : ObjectNotFound: (EntityFramework.psm1:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException