Skip to content

Commit 6c8a4f6

Browse files
authored
Stop trying to fetch applicationversion from v27+ databases (#4019)
With v27 the applicationVersion is gone from the $ndo$dbproperty table. There are a couple of places in BCContainerHelper where we try to fetch the application version from this property. We'll need to update that. Related to: #4018
1 parent 3caf7aa commit 6c8a4f6

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

AppHandling/Clean-BcContainerDatabase.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ try {
111111
$databaseServerInstance += "\$databaseInstance"
112112
}
113113

114-
if ($platformVersion.Major -ge 15) {
114+
if (($platformVersion.Major -ge 15) -and ($platformVersion.Major -le 26)) {
115115
$dbproperties = Invoke-Sqlcmd -ServerInstance $databaseServerInstance -Query "SELECT [applicationversion],[applicationfamily] FROM [$databaseName].[dbo].[`$ndo`$dbproperty]"
116+
} elseif( $platformVersion.Major -ge 27) {
117+
$dbproperties = Invoke-Sqlcmd -ServerInstance $databaseServerInstance -Query "SELECT [applicationfamily] FROM [$databaseName].[dbo].[`$ndo`$dbproperty]"
116118
}
117119

118120
if ($copyTables) {
@@ -144,9 +146,13 @@ try {
144146
Write-Host "Creating new database $databaseName on $databaseServerInstance with default Collation"
145147
}
146148

147-
if ($platformVersion.Major -ge 15) {
149+
if (($platformVersion.Major -ge 15) -and ($platformVersion.Major -le 26)) {
148150
New-NAVApplicationDatabase -DatabaseServer $databaseServerInstance -DatabaseName $databaseName @CollationParam | Out-Null
149151
Invoke-Sqlcmd -ServerInstance $databaseServerInstance -Query "UPDATE [$databaseName].[dbo].[`$ndo`$dbproperty] SET [applicationfamily] = '$($dbproperties.applicationfamily)', [applicationversion] = '$($dbproperties.applicationversion)'"
152+
} else
153+
{
154+
# In 27.x and later applicationversion is removed from the dbproperty table
155+
Invoke-Sqlcmd -ServerInstance $databaseServerInstance -Query "UPDATE [$databaseName].[dbo].[`$ndo`$dbproperty] SET [applicationfamily] = '$($dbproperties.applicationfamily)'"
150156
}
151157
else {
152158
Create-NAVDatabase -databasename $databaseName -databaseserver $databaseServerInstance @CollationParam | Out-Null

AppHandling/Compile-AppInNavContainer.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ try {
349349
}
350350

351351
$applicationApp = $publishedApps | Where-Object { $_.publisher -eq "Microsoft" -and $_.name -eq "Application" }
352-
if (-not $applicationApp) {
352+
if ((-not $applicationApp) -and ($platformversion -le [System.Version]"26.0.0.0")) {
353353
# locate application version number in database if using SQLEXPRESS
354354
try {
355355
if (($customConfig.DatabaseServer -eq "localhost") -and ($customConfig.DatabaseInstance -eq "SQLEXPRESS")) {

ReleaseNotes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
6.1.8
22
AL-Go issue 1920 Pagescript not working on own github runner
3+
Issue 4018 Using New-navcontainer with useNewDatabase=true for BC 27 fails
34

45
6.1.7
56
Issue 3952 Get-AlLanguageExtensionFromArtifacts fails on new BC artifacts

0 commit comments

Comments
 (0)