You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix - creation of missing reccord in table [Tenant Feature Key] (#3658)
In case that related record in SQL table [dbo].[Tenant Feature Key] is
missing, it is created automaticaly and then updated by this script as
usual.
Co-authored-by: Freddy Kristiansen <freddy.kristiansen@microsoft.com>
Copy file name to clipboardExpand all lines: Misc/Set-BcContainerFeatureKeys.ps1
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,18 @@ try {
70
70
}
71
71
if ($enabled-ne-1) {
72
72
try {
73
+
#Create new record in table of feature setup table [Tenant Feature Key] in case it is missing
74
+
$SQLRecord=Invoke-Sqlcmd-Database $databaseName-Query "SELECT * FROM [dbo].[Tenant Feature Key] where ID = '$featureKey'"
75
+
if ([String]::IsNullOrEmpty($SQLRecord))
76
+
{
77
+
Write-host-NoNewline "Creating record for feature ID '$featureKey' - "
78
+
$SQLcolumns="ID, Enabled"
79
+
$SQLvalues="'$featureKey',0"
80
+
Invoke-Sqlcmd-Database $databaseName-Query "INSERT INTO [CRONUS].[dbo].[Tenant Feature Key]($SQLcolumns) VALUES ($SQLvalues)"
81
+
if ($result[0] -eq"1") {
82
+
Write-Host" Created"
83
+
}
84
+
}
73
85
Write-Host-NoNewline "Setting feature key $featureKey to $enabledStr - "
74
86
$result=Invoke-Sqlcmd-Database $databaseName-Query "UPDATE [dbo].[Tenant Feature Key] set Enabled = $enabled where ID = '$featureKey';Select @@ROWCOUNT"
0 commit comments