Skip to content

Commit a9cc42b

Browse files
Migrate DataMigration from generation to main (#23252)
* Move DataMigration to main * Update ChangeLog.md --------- Co-authored-by: Yabo Hu <[email protected]>
1 parent 9290b61 commit a9cc42b

File tree

101 files changed

+507
-385
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+507
-385
lines changed

src/DataMigration/DataMigration.Autorest/build-module.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ if($NoDocs) {
143143
$null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
144144
}
145145
$null = New-Item -ItemType Directory -Force -Path $docsFolder
146-
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid
146+
$addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true')
147+
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid -AddComplexInterfaceInfo:$addComplexInterfaceInfo
147148
}
148149

149150
Write-Host -ForegroundColor Green 'Creating format.ps1xml...'
@@ -162,4 +163,10 @@ Export-TestStub -ModuleName $moduleName -ExportsFolder $exportsFolder -OutputFol
162163
Write-Host -ForegroundColor Green 'Creating example stubs...'
163164
Export-ExampleStub -ExportsFolder $exportsFolder -OutputFolder $examplesFolder
164165

166+
if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1'))
167+
{
168+
Write-Host -ForegroundColor Green 'Creating ux metadata...'
169+
. (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')
170+
}
171+
165172
Write-Host -ForegroundColor Green '-------------Done-------------'

src/DataMigration/DataMigration.Autorest/custom/Cmdlets/New-AzDataMigrationSqlServerSchema.ps1

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,59 @@ function New-AzDataMigrationSqlServerSchema
8787
#Testing Whether Console App is downloaded or not
8888
$TestExePath = Test-Path -Path $ExePath;
8989

90-
#Downloading and extracting SchemaMigration Zip file
90+
#Console app download address
91+
$ZipSource = "https://migrationapps.blob.core.windows.net/schemamigration/SqlSchemaMigration.zip";
92+
$ZipDestination = Join-Path -Path $BaseFolder -ChildPath "SqlSchemaMigration.zip";
93+
9194
if(-Not $TestExePath)
9295
{
93-
$ZipSource = "https://migrationapps.blob.core.windows.net/schemamigration/SqlSchemaMigration.zip";
94-
$ZipDestination = Join-Path -Path $BaseFolder -ChildPath "SqlSchemaMigration.zip";
96+
Write-Host "Downloading and extracting latest SchemaMigration Zip file..."
97+
98+
#Downloading and extracting SchemaMigration Zip file
9599
Invoke-RestMethod -Uri $ZipSource -OutFile $ZipDestination;
96-
97100
Expand-Archive -Path $ZipDestination -DestinationPath $BaseFolder -Force;
98101
}
99-
# To do:
100-
# else
101-
# {
102-
# check local exe version;
103-
# call storage account API to get latest version
104-
# if version does not match, pop up to choose download Yes/No
105-
# }
102+
else
103+
{
104+
# Get local exe version
105+
Write-Host "Checking installed SqlSchemaMigration.exe version...";
106+
$installedVersion = (Get-Item $ExePath).VersionInfo.FileVersion;
107+
Write-Host "Installed version: $installedVersion";
108+
109+
# Get latest console app version
110+
Write-Host "Checking whether there is newer version...";
111+
$VersionFileSource = "https://migrationapps.blob.core.windows.net/schemamigration/consoleappversion.json";
112+
$VersionFileDestination = Join-Path -Path $BaseFolder -ChildPath "consoleappversion.json";
113+
Invoke-RestMethod -Uri $VersionFileSource -OutFile $VersionFileDestination;
114+
$jsonObj = Get-Content $VersionFileDestination | Out-String | ConvertFrom-Json;
115+
$latestVersion = $jsonObj.version;
116+
117+
# Compare the latest exe version with the local exe version
118+
if([System.Version]$installedVersion -lt [System.Version]$latestVersion)
119+
{
120+
Write-Host "Found newer version SqlSchemaMigration.exe '$latestVersion'";
121+
122+
Write-Host "Removing old SqlSchemaMigration.exe..."
123+
# Remove old zip file
124+
Remove-Item -Path $ZipDestination;
125+
126+
# Remove existing folder and contents
127+
$ConsoleAppDestination = Join-Path -Path $BaseFolder -ChildPath "SchemaMigration.Console.csproj";
128+
Remove-Item -Path $ConsoleAppDestination -Recurse;
129+
130+
# Remove version file
131+
Remove-Item -Path $VersionFileDestination;
132+
133+
#Downloading and extracting SchemaMigration Zip file
134+
Write-Host "Downloading and extracting latest SchemaMigration Zip file..."
135+
Invoke-RestMethod -Uri $ZipSource -OutFile $ZipDestination;
136+
Expand-Archive -Path $ZipDestination -DestinationPath $BaseFolder -Force;
137+
}
138+
else
139+
{
140+
Write-Host "Installed SqlSchemaMigration.exe is the latest one...";
141+
}
142+
}
106143

107144
#Collecting data
108145
if($PSCmdlet.ParameterSetName -eq 'CommandLine')
@@ -149,4 +186,4 @@ function New-AzDataMigrationSqlServerSchema
149186
throw $_
150187
}
151188
}
152-
}
189+
}

src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationAssessment.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
148148
149149
## NOTES
150150
151-
ALIASES
152-
153151
## RELATED LINKS
154152

src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationPerformanceDataCollection.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
257257
258258
## NOTES
259259
260-
ALIASES
261-
262260
## RELATED LINKS
263261

src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSkuRecommendation.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
338338
339339
## NOTES
340340
341-
ALIASES
342-
343341
## RELATED LINKS
344342

src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlService.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -191,22 +191,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
191191
192192
## NOTES
193193
194-
ALIASES
195-
196-
COMPLEX PARAMETER PROPERTIES
197-
198-
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
199-
200-
201-
`INPUTOBJECT <IDataMigrationIdentity>`: Identity Parameter
202-
- `[Id <String>]`: Resource identity path
203-
- `[ManagedInstanceName <String>]`:
204-
- `[ResourceGroupName <String>]`: Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
205-
- `[SqlDbInstanceName <String>]`:
206-
- `[SqlMigrationServiceName <String>]`: Name of the SQL Migration Service.
207-
- `[SqlVirtualMachineName <String>]`:
208-
- `[SubscriptionId <String>]`: Subscription ID that identifies an Azure subscription.
209-
- `[TargetDbName <String>]`: The name of the target database.
210-
211194
## RELATED LINKS
212195

src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceAuthKey.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
157157
158158
## NOTES
159159
160-
ALIASES
161-
162160
## RELATED LINKS
163161

src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceIntegrationRuntimeMetric.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
172172
173173
## NOTES
174174
175-
ALIASES
176-
177175
## RELATED LINKS
178176

src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceMigration.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
127127
128128
## NOTES
129129
130-
ALIASES
131-
132130
## RELATED LINKS
133131

src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationToSqlDb.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -210,22 +210,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
210210
211211
## NOTES
212212
213-
ALIASES
214-
215-
COMPLEX PARAMETER PROPERTIES
216-
217-
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
218-
219-
220-
`INPUTOBJECT <IDataMigrationIdentity>`: Identity Parameter
221-
- `[Id <String>]`: Resource identity path
222-
- `[ManagedInstanceName <String>]`:
223-
- `[ResourceGroupName <String>]`: Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
224-
- `[SqlDbInstanceName <String>]`:
225-
- `[SqlMigrationServiceName <String>]`: Name of the SQL Migration Service.
226-
- `[SqlVirtualMachineName <String>]`:
227-
- `[SubscriptionId <String>]`: Subscription ID that identifies an Azure subscription.
228-
- `[TargetDbName <String>]`: The name of the target database.
229-
230213
## RELATED LINKS
231214

0 commit comments

Comments
 (0)