From ac460adfc35d577bf0c9d31d9bea765ada8b9ae5 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra <13396919+cheenamalhotra@users.noreply.github.com> Date: Mon, 9 Jan 2023 17:47:27 -0800 Subject: [PATCH] Enable IsLedger only for SQL 2022 (#1804) --- docs/guide/object_explorer.md | 8 +- .../ObjectExplorer/SmoModel/SmoTreeNodes.cs | 90 ++++++++-------- .../SmoModel/SmoTreeNodesDefinition.xml | 100 +++++++++--------- .../ObjectExplorer/ValidForFlag.cs | 15 ++- .../ObjectExplorer/NodeFilterTests.cs | 22 ++-- 5 files changed, 120 insertions(+), 115 deletions(-) diff --git a/docs/guide/object_explorer.md b/docs/guide/object_explorer.md index 7836889b..5dff5043 100644 --- a/docs/guide/object_explorer.md +++ b/docs/guide/object_explorer.md @@ -51,7 +51,7 @@ For example, to get the table node, we also need to get three properties IsSyste TableTemporalType.None TableTemporalType.SystemVersioned - + LedgerTableType.None LedgerTableType.UpdatableLedgerTable LedgerTableType.AppendOnlyLedgerTable @@ -60,7 +60,7 @@ For example, to get the table node, we also need to get three properties IsSyste - + @@ -72,10 +72,10 @@ For example, to get the table node, we also need to get three properties IsSyste - + TableTemporalType.HistoryTable - + LedgerTableType.HistoryTable diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodes.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodes.cs index b0985999..84718129 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodes.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodes.cs @@ -216,7 +216,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel properties.Add(new NodeSmoProperty { Name = "IsLedger", - ValidFor = ValidForFlag.AllOnPrem + ValidFor = ValidForFlag.Sql2022OrHigher }); return properties; } @@ -700,7 +700,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.Synonyms, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.AllOnPrem|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -716,7 +716,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.ExternalResources, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12|ValidForFlag.SqlOnDemand, + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.AzureV12|ValidForFlag.SqlOnDemand, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -783,7 +783,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { Property = "TemporalType", Type = typeof(Enum), - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.AzureV12, Values = new List { { TableTemporalType.None }, @@ -794,7 +794,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { Property = "LedgerType", Type = typeof(Enum), - ValidFor = ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12, Values = new List { { LedgerTableType.None }, @@ -806,7 +806,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { Property = "IsDroppedLedgerTable", Type = typeof(bool), - ValidFor = ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12, Values = new List { 0 }, }); return filters; @@ -821,37 +821,37 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel properties.Add(new NodeSmoProperty { Name = "IsFileTable", - ValidFor = ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022 + ValidFor = ValidForFlag.Sql2012OrHigher }); properties.Add(new NodeSmoProperty { Name = "IsSystemVersioned", - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12 + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.AzureV12 }); properties.Add(new NodeSmoProperty { Name = "TemporalType", - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12 + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.AzureV12 }); properties.Add(new NodeSmoProperty { Name = "LedgerType", - ValidFor = ValidForFlag.Sql2022|ValidForFlag.AzureV12 + ValidFor = ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12 }); properties.Add(new NodeSmoProperty { Name = "IsExternal", - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12|ValidForFlag.SqlOnDemand + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.AzureV12|ValidForFlag.SqlOnDemand }); properties.Add(new NodeSmoProperty { Name = "IsEdge", - ValidFor = ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12 + ValidFor = ValidForFlag.Sql2017OrHigher|ValidForFlag.AzureV12 }); properties.Add(new NodeSmoProperty { Name = "IsNode", - ValidFor = ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12 + ValidFor = ValidForFlag.Sql2017OrHigher|ValidForFlag.AzureV12 }); return properties; } @@ -872,7 +872,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.DroppedLedgerTables, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12, SortPriority = Int32.MaxValue, }); } @@ -914,7 +914,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { Property = "IsDroppedLedgerView", Type = typeof(bool), - ValidFor = ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12, Values = new List { 0 }, }); return filters; @@ -951,7 +951,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeTypeId = NodeTypes.DroppedLedgerViews, IsSystemObject = false, IsMsShippedOwned = true, - ValidFor = ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12, SortPriority = Int32.MaxValue, }); } @@ -1024,7 +1024,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.DatabaseTriggers, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.AllOnPrem|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1048,7 +1048,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.Sequences, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2012OrHigher|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); } @@ -1075,7 +1075,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.ExternalDataSources, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12|ValidForFlag.SqlOnDemand, + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.AzureV12|ValidForFlag.SqlOnDemand, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1083,7 +1083,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.ExternalFileFormats, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.SqlOnDemand, + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.SqlOnDemand, SortPriority = SmoTreeNode.NextSortPriority, }); } @@ -1145,7 +1145,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.BrokerPriorities, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022, + ValidFor = ValidForFlag.Sql2008OrHigher, SortPriority = SmoTreeNode.NextSortPriority, }); } @@ -1186,7 +1186,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.FullTextStopLists, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2008OrHigher|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1215,7 +1215,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.SearchPropertyLists, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2012OrHigher|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); } @@ -1287,7 +1287,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.DatabaseScopedCredentials, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1295,7 +1295,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.DatabaseEncryptionKeys, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022, + ValidFor = ValidForFlag.Sql2008OrHigher, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1311,7 +1311,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.DatabaseAuditSpecifications, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022, + ValidFor = ValidForFlag.Sql2008OrHigher, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1319,7 +1319,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.SecurityPolicies, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1327,7 +1327,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.AlwaysEncryptedKeys, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); } @@ -1407,7 +1407,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel properties.Add(new NodeSmoProperty { Name = "IsDroppedLedgerTable", - ValidFor = ValidForFlag.Sql2022|ValidForFlag.AzureV12 + ValidFor = ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12 }); return properties; } @@ -1448,7 +1448,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel Property = "TemporalType", Type = typeof(Enum), TypeToReverse = typeof(SqlHistoryTableQuerier), - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.AzureV12, Values = new List { { TableTemporalType.HistoryTable } @@ -1459,7 +1459,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel Property = "LedgerType", Type = typeof(Enum), TypeToReverse = typeof(SqlHistoryTableQuerier), - ValidFor = ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12, Values = new List { { LedgerTableType.HistoryTable } @@ -1479,12 +1479,12 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel properties.Add(new NodeSmoProperty { Name = "LedgerType", - ValidFor = ValidForFlag.Sql2022|ValidForFlag.AzureV12 + ValidFor = ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12 }); properties.Add(new NodeSmoProperty { Name = "TemporalType", - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12 + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.AzureV12 }); return properties; } @@ -1519,7 +1519,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.Triggers, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.AllOnPrem|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1672,7 +1672,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { Property = "IsDroppedLedgerColumn", Type = typeof(bool), - ValidFor = ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12, Values = new List { 0 }, }); return filters; @@ -1686,7 +1686,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.DroppedLedgerColumns, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12, SortPriority = Int32.MaxValue, }); } @@ -1725,7 +1725,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { Property = "IsDroppedLedgerColumn", Type = typeof(bool), - ValidFor = ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12, Values = new List { 1 }, }); return filters; @@ -1965,7 +1965,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { Property = "IsDroppedLedgerView", Type = typeof(bool), - ValidFor = ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12, Values = new List { 1 }, }); return filters; @@ -2008,7 +2008,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.Triggers, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.AllOnPrem|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -2206,7 +2206,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.UserDefinedDataTypes, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.AllOnPrem|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -2214,7 +2214,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.UserDefinedTableTypes, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2008OrHigher|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -2338,7 +2338,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.SystemSpatialDataTypes, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2008OrHigher|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); } @@ -2536,7 +2536,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel Property = "IndexKeyType", Type = typeof(Enum), TypeToReverse = typeof(SqlIndexQuerier), - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.AzureV12, Values = new List { { IndexKeyType.DriPrimaryKey }, @@ -3940,7 +3940,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.ColumnMasterKeys, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -3948,7 +3948,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.ColumnEncryptionKeys, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016OrHigher|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); } diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml index 9a5cbf62..375fc2c1 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoTreeNodesDefinition.xml @@ -13,7 +13,7 @@ - + @@ -45,7 +45,7 @@ @@ -76,25 +76,25 @@ - + TableTemporalType.None TableTemporalType.SystemVersioned - + LedgerTableType.None LedgerTableType.AppendOnlyLedgerTable LedgerTableType.UpdatableLedgerTable - + - - - - - - - + + + + + + + @@ -104,7 +104,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -126,7 +126,7 @@ --> - + @@ -173,21 +173,21 @@ - + - + - + - + - + - + - + @@ -253,7 +253,7 @@ - + @@ -271,9 +271,9 @@ - + - + @@ -296,7 +296,7 @@ - + @@ -309,7 +309,7 @@ --> - + @@ -322,8 +322,8 @@ - - + + @@ -335,7 +335,7 @@ - + IndexKeyType.DriPrimaryKey IndexKeyType.DriUniqueKey @@ -351,11 +351,11 @@ - + - - + + @@ -433,15 +433,15 @@ --> - + - + - + @@ -459,24 +459,24 @@ - + - - - - + + + + - - + + diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ValidForFlag.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ValidForFlag.cs index b428e98e..efe1256f 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ValidForFlag.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ValidForFlag.cs @@ -26,11 +26,16 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer AzureSqlDWGen3 = 0x200, Sql2019 = 0x400, Sql2022 = 0x800, - AllOnPrem = Sql2005 | Sql2008 | Sql2012 | Sql2014 | Sql2016 | Sql2017 | Sql2019 | Sql2022, + Sql2022OrHigher = Sql2022, + Sql2017OrHigher = Sql2017 | Sql2019 | Sql2022OrHigher, + Sql2016OrHigher = Sql2016 | Sql2017OrHigher, + Sql2012OrHigher = Sql2012 | Sql2014 | Sql2016OrHigher, + Sql2008OrHigher = Sql2008 | Sql2012OrHigher, + AllOnPrem = Sql2005 | Sql2008OrHigher, AllAzure = AzureV12, - All = Sql2005 | Sql2008 | Sql2012 | Sql2014 | Sql2016 | Sql2017 | Sql2019 | Sql2022 | AzureV12 | SqlDw | SqlOnDemand, - NotSqlDw = Sql2005 | Sql2008 | Sql2012 | Sql2014 | Sql2016 | Sql2017 | Sql2019 | Sql2022 | AzureV12 | SqlOnDemand, - NotSqlDemand = Sql2005 | Sql2008 | Sql2012 | Sql2014 | Sql2016 | Sql2017 | Sql2019 | Sql2022 | AzureV12 | SqlDw, - NotSqlDwNotDemand = Sql2005 | Sql2008 | Sql2012 | Sql2014 | Sql2016 | Sql2017 | Sql2019 | Sql2022 | AzureV12, + All = AllOnPrem | AzureV12 | SqlDw | SqlOnDemand, + NotSqlDw = AllOnPrem | AzureV12 | SqlOnDemand, + NotSqlDemand = AllOnPrem | AzureV12 | SqlDw, + NotSqlDwNotDemand = AllOnPrem | AzureV12, } } diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodeFilterTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodeFilterTests.cs index f8fcebef..cf18c599 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodeFilterTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/ObjectExplorer/NodeFilterTests.cs @@ -23,7 +23,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer Property = "TemporalType", Type = typeof(Enum), TypeToReverse = typeof(SqlHistoryTableQuerier), - ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.Sql2019|ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12, Values = new List { { TableTemporalType.HistoryTable } @@ -36,7 +36,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer Property = "LedgerType", Type = typeof(Enum), TypeToReverse = typeof(SqlHistoryTableQuerier), - ValidFor = ValidForFlag.Sql2022|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2022OrHigher|ValidForFlag.AzureV12, Values = new List { { LedgerTableType.HistoryTable } @@ -64,7 +64,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer } }; - string allFiltersValid = orNode.ToPropertyFilterString(typeof(SqlHistoryTableQuerier), ValidForFlag.Sql2022); + string allFiltersValid = orNode.ToPropertyFilterString(typeof(SqlHistoryTableQuerier), ValidForFlag.Sql2022OrHigher); string expectedAllFilters = "((@TemporalType = 1) or (@LedgerType = 1))"; Assert.That(allFiltersValid, Is.EqualTo(expectedAllFilters), "ToPropertyFilterString did not construct the URN filter string as expected for NodeOrFilter"); @@ -72,7 +72,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer string expectedSql2016Filters = "((@TemporalType = 1))"; Assert.That(sql2016ServerVersion, Is.EqualTo(expectedSql2016Filters), "ToPropertyFilterString did not construct the URN filter string as expected when excluding filters that aren't valid for the given server type."); - string invalidQuerierType = orNode.ToPropertyFilterString(typeof(SqlTableQuerier), ValidForFlag.Sql2022); + string invalidQuerierType = orNode.ToPropertyFilterString(typeof(SqlTableQuerier), ValidForFlag.Sql2022OrHigher); Assert.That(invalidQuerierType, Is.Empty, "ToPropertyFilterString should return empty string, because no given filters match the querier type provided."); } @@ -91,7 +91,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer } }; - string allFiltersValid = INodeFilter.GetPropertyFilter(nodeList, typeof(SqlHistoryTableQuerier), ValidForFlag.Sql2022); + string allFiltersValid = INodeFilter.GetPropertyFilter(nodeList, typeof(SqlHistoryTableQuerier), ValidForFlag.Sql2022OrHigher); string expectedAllFilters = "[((@TemporalType = 1) or (@LedgerType = 1))]"; Assert.That(allFiltersValid, Is.EqualTo(expectedAllFilters), "GetPropertyFilter did not construct the URN filter string as expected"); } @@ -107,7 +107,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer LedgerHistoryFilter }; - string allFiltersValid = INodeFilter.GetPropertyFilter(nodeList, typeof(SqlHistoryTableQuerier), ValidForFlag.Sql2022); + string allFiltersValid = INodeFilter.GetPropertyFilter(nodeList, typeof(SqlHistoryTableQuerier), ValidForFlag.Sql2022OrHigher); string expectedAllFilters = "[(@TemporalType = 1) and (@LedgerType = 1)]"; Assert.That(allFiltersValid, Is.EqualTo(expectedAllFilters), "GetPropertyFilter did not construct the URN filter string as expected"); @@ -115,7 +115,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer string expectedSql2016Filters = "[(@TemporalType = 1)]"; Assert.That(sql2016ServerVersion, Is.EqualTo(expectedSql2016Filters), "GetPropertyFilter did not construct the URN filter string as expected when excluding filters that aren't valid for the given server type."); - string invalidQuerierType = INodeFilter.GetPropertyFilter(nodeList, typeof(SqlTableQuerier), ValidForFlag.Sql2022); + string invalidQuerierType = INodeFilter.GetPropertyFilter(nodeList, typeof(SqlTableQuerier), ValidForFlag.Sql2022OrHigher); Assert.That(invalidQuerierType, Is.Empty, "GetPropertyFilter should return empty string, because no given filters match the querier type provided."); } @@ -137,7 +137,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer SystemObjectFilter }; - string allFiltersValid = INodeFilter.GetPropertyFilter(nodeList, typeof(SqlHistoryTableQuerier), ValidForFlag.Sql2022); + string allFiltersValid = INodeFilter.GetPropertyFilter(nodeList, typeof(SqlHistoryTableQuerier), ValidForFlag.Sql2022OrHigher); string expectedAllFilters = "[((@TemporalType = 1) or (@LedgerType = 1)) and (@IsSystemObject = 1)]"; Assert.That(allFiltersValid, Is.EqualTo(expectedAllFilters), "GetPropertyFilter did not construct the URN filter string as expected"); @@ -145,7 +145,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer string expectedSql2016Filters = "[((@TemporalType = 1)) and (@IsSystemObject = 1)]"; Assert.That(sql2016ServerVersion, Is.EqualTo(expectedSql2016Filters), "GetPropertyFilter did not construct the URN filter string as expected when excluding filters that aren't valid for the given server type."); - string invalidQuerierType = INodeFilter.GetPropertyFilter(nodeList, typeof(SqlTableQuerier), ValidForFlag.Sql2022); + string invalidQuerierType = INodeFilter.GetPropertyFilter(nodeList, typeof(SqlTableQuerier), ValidForFlag.Sql2022OrHigher); string expectedTableQuerierFilters = "[(@IsSystemObject = 1)]"; Assert.That(invalidQuerierType, Is.EqualTo(expectedTableQuerierFilters), "GetPropertyFilter did not construct the URN filter string as expected when excluding filters that don't match the querier type."); } @@ -179,7 +179,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer orNode2 }; - string allFiltersValid = INodeFilter.GetPropertyFilter(nodeList, typeof(SqlHistoryTableQuerier), ValidForFlag.Sql2022); + string allFiltersValid = INodeFilter.GetPropertyFilter(nodeList, typeof(SqlHistoryTableQuerier), ValidForFlag.Sql2022OrHigher); string expectedAllFilters = "[((@TemporalType = 1) or (@LedgerType = 1)) and (@IsSystemObject = 1) and ((@IsSystemObject = 1) or (@LedgerType = 1) or (@TemporalType = 1))]"; Assert.That(allFiltersValid, Is.EqualTo(expectedAllFilters), "GetPropertyFilter did not construct the URN filter string as expected"); @@ -187,7 +187,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer string expectedSql2016Filters = "[((@TemporalType = 1)) and (@IsSystemObject = 1) and ((@IsSystemObject = 1) or (@TemporalType = 1))]"; Assert.That(sql2016ServerVersion, Is.EqualTo(expectedSql2016Filters), "GetPropertyFilter did not construct the URN filter string as expected when excluding filters that aren't valid for the given server type."); - string invalidQuerierType = INodeFilter.GetPropertyFilter(nodeList, typeof(SqlTableQuerier), ValidForFlag.Sql2022); + string invalidQuerierType = INodeFilter.GetPropertyFilter(nodeList, typeof(SqlTableQuerier), ValidForFlag.Sql2022OrHigher); string expectedTableQuerierFilters = "[(@IsSystemObject = 1) and ((@IsSystemObject = 1))]"; Assert.That(invalidQuerierType, Is.EqualTo(expectedTableQuerierFilters), "GetPropertyFilter did not construct the URN filter string as expected when excluding filters that don't match the querier type."); }