File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -337,7 +337,7 @@ class SqlDatabase : SqlResourceBase
337337 $Collation
338338
339339 [DscProperty ()]
340- [Nullable [ DatabaseCompatibilityLevel ] ]
340+ [DatabaseCompatibilityLevel ]
341341 $CompatibilityLevel
342342
343343 [DscProperty ()]
@@ -738,7 +738,13 @@ class SqlDatabase : SqlResourceBase
738738
739739 # Basic properties
740740 $currentState.Collation = $databaseObject.Collation
741- $currentState.CompatibilityLevel = [DatabaseCompatibilityLevel ] $databaseObject.CompatibilityLevel.ToString ()
741+
742+ # Only set CompatibilityLevel if it's a valid non-zero value
743+ if ($databaseObject.CompatibilityLevel -gt 0 )
744+ {
745+ $currentState.CompatibilityLevel = [DatabaseCompatibilityLevel ] $databaseObject.CompatibilityLevel.ToString ()
746+ }
747+
742748 $currentState.RecoveryModel = $databaseObject.RecoveryModel.ToString ()
743749 $currentState.OwnerName = $databaseObject.Owner
744750 $currentState.SnapshotIsolation = $databaseObject.SnapshotIsolationState -eq ' Enabled'
You can’t perform that action at this time.
0 commit comments