diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs index 60609322..b596a194 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs @@ -9061,6 +9061,78 @@ namespace Microsoft.SqlTools.ServiceLayer } } + public static string TableColumnComputedGroupTitle + { + get + { + return Keys.GetString(Keys.TableColumnComputedGroupTitle); + } + } + + public static string TableColumnIsComputedTitle + { + get + { + return Keys.GetString(Keys.TableColumnIsComputedTitle); + } + } + + public static string TableColumnIsComputedDescription + { + get + { + return Keys.GetString(Keys.TableColumnIsComputedDescription); + } + } + + public static string TableColumnComputedFormulaTitle + { + get + { + return Keys.GetString(Keys.TableColumnComputedFormulaTitle); + } + } + + public static string TableColumnComputedFormulaDescription + { + get + { + return Keys.GetString(Keys.TableColumnComputedFormulaDescription); + } + } + + public static string TableColumnIsComputedPersistedTitle + { + get + { + return Keys.GetString(Keys.TableColumnIsComputedPersistedTitle); + } + } + + public static string TableColumnIsComputedPersistedDescription + { + get + { + return Keys.GetString(Keys.TableColumnIsComputedPersistedDescription); + } + } + + public static string TableColumnIsComputedPersistedNullableTitle + { + get + { + return Keys.GetString(Keys.TableColumnIsComputedPersistedNullableTitle); + } + } + + public static string TableColumnIsComputedPersistedNullableDescription + { + get + { + return Keys.GetString(Keys.TableColumnIsComputedPersistedNullableDescription); + } + } + public static string ConnectionServiceListDbErrorNotConnected(string uri) { return Keys.GetString(Keys.ConnectionServiceListDbErrorNotConnected, uri); @@ -12952,6 +13024,33 @@ namespace Microsoft.SqlTools.ServiceLayer public const string AddNewClauseLabel = "AddNewClauseLabel"; + public const string TableColumnComputedGroupTitle = "TableColumnComputedGroupTitle"; + + + public const string TableColumnIsComputedTitle = "TableColumnIsComputedTitle"; + + + public const string TableColumnIsComputedDescription = "TableColumnIsComputedDescription"; + + + public const string TableColumnComputedFormulaTitle = "TableColumnComputedFormulaTitle"; + + + public const string TableColumnComputedFormulaDescription = "TableColumnComputedFormulaDescription"; + + + public const string TableColumnIsComputedPersistedTitle = "TableColumnIsComputedPersistedTitle"; + + + public const string TableColumnIsComputedPersistedDescription = "TableColumnIsComputedPersistedDescription"; + + + public const string TableColumnIsComputedPersistedNullableTitle = "TableColumnIsComputedPersistedNullableTitle"; + + + public const string TableColumnIsComputedPersistedNullableDescription = "TableColumnIsComputedPersistedNullableDescription"; + + private Keys() { } diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx index 65fa910c..355fe072 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx @@ -4947,4 +4947,40 @@ The Query Processor estimates that implementing the following index could improv New Clause + + Computed Column Specifications + + + + Is Computed + + + + Specifies whether the column is a computed column + + + + Formula + + + + Formula that the column uses if it is a computed column + + + + Is Persisted + + + + Whether the computed column is saved with the data source + + + + Is Persisted Nullable + + + + Whether the computed column can have a NULL value (NOT NULL can only be specified if the column is persisted) + + diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings index 898e8cd9..247d4897 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings @@ -2311,4 +2311,13 @@ TableDesignerNewHistoryTableTitle = New History Table Name TableColumnDefaultConstraintNamePropertyDescription = Specifies the default constraint name. TableColumnDefaultConstraintNamePropertyTitle = Default Constraint Name AddNewEdgeConstraintLabel = New Edge Constraint -AddNewClauseLabel = New Clause \ No newline at end of file +AddNewClauseLabel = New Clause +TableColumnComputedGroupTitle = Computed Column Specifications +TableColumnIsComputedTitle = Is Computed +TableColumnIsComputedDescription = Specifies whether the column is a computed column +TableColumnComputedFormulaTitle = Formula +TableColumnComputedFormulaDescription = Formula that the column uses if it is a computed column +TableColumnIsComputedPersistedTitle = Is Persisted +TableColumnIsComputedPersistedDescription = Whether the computed column is saved with the data source +TableColumnIsComputedPersistedNullableTitle = Is Persisted Nullable +TableColumnIsComputedPersistedNullableDescription = Whether the computed column can have a NULL value (NOT NULL can only be specified if the column is persisted) \ No newline at end of file diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf index 75f47cb1..cd6a3743 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf @@ -6023,6 +6023,51 @@ The Query Processor estimates that implementing the following index could improv Parallel Execution tooltip text for node parallelism overlay + + Computed Column Specifications + Computed Column Specifications + + + + Is Computed + Is Computed + + + + Specifies whether the column is a computed column + Specifies whether the column is a computed column + + + + Is Persisted + Is Persisted + + + + Whether the computed column is saved with the data source + Whether the computed column is saved with the data source + + + + Is Persisted Nullable + Is Persisted Nullable + + + + Whether the computed column can have a NULL value (NOT NULL can only be specified if the column is persisted) + Whether the computed column can have a NULL value (NOT NULL can only be specified if the column is persisted) + + + + Formula that the column uses if it is a computed column + Formula that the column uses if it is a computed column + + + + Formula + Formula + + \ No newline at end of file diff --git a/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/Constants.cs b/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/Constants.cs index f461f768..b20d8276 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/Constants.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/Constants.cs @@ -43,6 +43,10 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner public const string IsIdentity = "isIdentity"; public const string IdentityIncrement = "identityIncrement"; public const string IdentitySeed = "identitySeed"; + public const string IsComputed = "isComputed"; + public const string ComputedFormula = "computedFormula"; + public const string IsComputedPersisted = "isComputedPersisted"; + public const string IsComputedPersistedNullable = "isComputedPersistedNullable"; public const string CanBeDeleted = "canBeDeleted"; public const string GeneratedAlwaysAs = "generatedAlwaysAs"; public const string IsHidden = "isHidden"; diff --git a/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/Contracts/ViewModel/TableColumnViewModel.cs b/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/Contracts/ViewModel/TableColumnViewModel.cs index d2511c7c..9847e880 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/Contracts/ViewModel/TableColumnViewModel.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/Contracts/ViewModel/TableColumnViewModel.cs @@ -31,6 +31,14 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner.Contracts public InputBoxProperties IdentityIncrement { get; set; } = new InputBoxProperties(); + public CheckBoxProperties IsComputed { get; set; } = new CheckBoxProperties(); + + public InputBoxProperties ComputedFormula { get; set; } = new InputBoxProperties(); + + public CheckBoxProperties IsComputedPersisted { get; set; } = new CheckBoxProperties(); + + public CheckBoxProperties IsComputedPersistedNullable { get; set; } = new CheckBoxProperties(); + public DropdownProperties GeneratedAlwaysAs { get; set; } = new DropdownProperties(); public CheckBoxProperties IsHidden { get; set; } = new CheckBoxProperties(); diff --git a/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/TableDesignerService.cs b/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/TableDesignerService.cs index b7e2eff0..857bca3e 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/TableDesignerService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/TableDesignerService.cs @@ -507,6 +507,18 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner case TableColumnPropertyNames.DefaultConstraintName: column.DefaultConstraintName = GetStringValue(newValue); break; + case TableColumnPropertyNames.IsComputed: + column.IsComputed = GetBooleanValue(newValue); + break; + case TableColumnPropertyNames.ComputedFormula: + column.ComputedFormula = GetStringValue(newValue); + break; + case TableColumnPropertyNames.IsComputedPersisted: + column.IsComputedPersisted = GetBooleanValue(newValue); + break; + case TableColumnPropertyNames.IsComputedPersistedNullable: + column.IsComputedPersistedNullable = GetBooleanValue(newValue); + break; default: break; } @@ -816,6 +828,14 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner columnViewModel.IdentityIncrement.Enabled = column.CanEditIdentityValues; columnViewModel.IdentityIncrement.Value = column.IdentityIncrement?.ToString(); columnViewModel.CanBeDeleted = column.CanBeDeleted; + columnViewModel.IsComputed.Enabled = column.CanEditIsComputed; + columnViewModel.IsComputed.Checked = column.IsComputed; + columnViewModel.ComputedFormula.Enabled = column.CanEditComputedFormula; + columnViewModel.ComputedFormula.Value = column.ComputedFormula; + columnViewModel.IsComputedPersisted.Enabled = column.CanEditIsComputedPersisted; + columnViewModel.IsComputedPersisted.Checked = column.IsComputedPersisted == true; + columnViewModel.IsComputedPersistedNullable.Enabled = column.CanEditIsComputedPersistedNullable; + columnViewModel.IsComputedPersistedNullable.Checked = column.IsComputedPersistedNullable == true; columnViewModel.GeneratedAlwaysAs.Value = ColumnGeneratedAlwaysAsTypeUtil.Instance.GetName(column.GeneratedAlwaysAs); columnViewModel.GeneratedAlwaysAs.Values = ColumnGeneratedAlwaysAsTypeUtil.Instance.DisplayNames; columnViewModel.GeneratedAlwaysAs.Enabled = column.CanEditGeneratedAlwaysAs; @@ -1004,6 +1024,50 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { Title = SR.TableColumnDefaultConstraintNamePropertyTitle } + }, + new DesignerDataPropertyInfo() + { + PropertyName = TableColumnPropertyNames.IsComputed, + Description = SR.TableColumnIsComputedDescription, + Group = SR.TableColumnComputedGroupTitle, + ComponentType = DesignerComponentType.Checkbox, + ComponentProperties = new CheckBoxProperties() + { + Title = SR.TableColumnIsComputedTitle + } + }, + new DesignerDataPropertyInfo() + { + PropertyName = TableColumnPropertyNames.ComputedFormula, + Description = SR.TableColumnComputedFormulaDescription, + Group = SR.TableColumnComputedGroupTitle, + ComponentType = DesignerComponentType.Input, + ComponentProperties = new InputBoxProperties() + { + Title = SR.TableColumnComputedFormulaTitle + } + }, + new DesignerDataPropertyInfo() + { + PropertyName = TableColumnPropertyNames.IsComputedPersisted, + Description = SR.TableColumnIsComputedPersistedDescription, + Group = SR.TableColumnComputedGroupTitle, + ComponentType = DesignerComponentType.Checkbox, + ComponentProperties = new CheckBoxProperties() + { + Title = SR.TableColumnIsComputedPersistedTitle + } + }, + new DesignerDataPropertyInfo() + { + PropertyName = TableColumnPropertyNames.IsComputedPersistedNullable, + Description = SR.TableColumnIsComputedPersistedNullableDescription, + Group = SR.TableColumnComputedGroupTitle, + ComponentType = DesignerComponentType.Checkbox, + ComponentProperties = new CheckBoxProperties() + { + Title = SR.TableColumnIsComputedPersistedNullableTitle + } } }); view.ColumnTableOptions.CanAddRows = true;