-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFullDeploy.ps1
31 lines (21 loc) · 982 Bytes
/
FullDeploy.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$projectRelaPath = "ERP.Database\ERP.Database.sqlproj"
$target = New-DatabaseConnection -ServerInstance "." -Database "ERP" -Username "sa" -Password "123456a@"
$exportRelaPath = "Artifact"
$PackageId = "MyDataBase"
$PackageVersion = "1.0.0"
$project = $(Resolve-Path -Path $projectRelaPath)
$ArtifactPath = $exportRelaPath + "\" + $PackageId + "." + $PackageVersion + ".nupkg"
# Build
if (Test-Path -Path $exportRelaPath)
{
Remove-Item $exportRelaPath -force -recurse
}
mkdir $exportRelaPath
$exportPath = $(Resolve-Path -Path $exportRelaPath)
$validatedProject = $project | Invoke-DatabaseBuild
$buildArtifact = $validatedProject | New-DatabaseBuildArtifact -PackageId $PackageId -PackageVersion $PackageVersion
$buildArtifact | Export-DatabaseBuildArtifact -Path $exportPath
# Deploy
$Artifact = Import-DatabaseBuildArtifact $ArtifactPath
$update = New-DatabaseReleaseArtifact -Source $Artifact -Target $target
Use-DatabaseReleaseArtifact $update -DeployTo $target