在Octopus将CI迁移到Azure期间运行实体框架迁移

mar*_*rin 7 entity-framework azure octopus-deploy

我需要建立一个持续集成过程,使用Octopus Deploy将我们的应用程序部署为Azure云服务.此过程包括对Azure SQL数据库执行Entity Framework 6.1迁移的步骤(通过migrate.exe从本地Octopus触角运行).但是,需要在八达通机器上打开端口1433才能使其工作,我们的管理员不会这样做.

是否有不同的方法可以建议在自动部署过程中执行Entity Framework迁移?

mar*_*rin 2

我们最终打开了该端口,因为我们找不到任何其他解决方案。作为参考,下面是我们正在运行的脚本(我们的 Deploy.ps1 脚本,由 NuGet 在每次部署中执行)。

# SOURCE: http://danpiessens.com/blog/2014/06/10/deploying-databases-with-octopus-deploy-part-2/

# Get the exe name based on the directory
$contentPath = (Join-Path $OctopusOriginalPackageDirectoryPath "content")
$fullPath = (Join-Path $OctopusOriginalPackageDirectoryPath "content\migrate.exe")

Write-Host "Content Path:" $contentPath
Write-Host "Migrate Path:" $fullPath

cd $contentPath
write-host "Working Dir: "$(get-location)

# Run the migration utility

& "$fullPath" MyApp.Data.dll /startUpConfigurationFile=MyApp.Web.dll.config /connectionString=$ApplicationConnectionString /connectionProviderName="System.Data.SqlClient" /verbose | Write-Host
Run Code Online (Sandbox Code Playgroud)