diff --git a/forward_engineering/alterScript/alterScriptHelpers/alterEntityHelper.js b/forward_engineering/alterScript/alterScriptHelpers/alterEntityHelper.js index 899767d..5b3ba17 100644 --- a/forward_engineering/alterScript/alterScriptHelpers/alterEntityHelper.js +++ b/forward_engineering/alterScript/alterScriptHelpers/alterEntityHelper.js @@ -5,6 +5,7 @@ const { getUpdateTypesScriptDtos } = require('./columnHelpers/alterTypeHelper'); const { getModifyNonNullColumnsScriptDtos } = require('./columnHelpers/nonNullConstraintHelper'); const { getModifiedCommentOnColumnScriptDtos } = require('./columnHelpers/commentsHelper'); const { getRenameColumnScriptDtos } = require('./columnHelpers/renameColumnHelper'); +const { getModifyColumnCheckConstraintScriptDtos } = require('./columnHelpers/checkConstraintHelper'); const { AlterScriptDto } = require('../types/AlterScriptDto'); const { AlterCollectionDto } = require('../types/AlterCollectionDto'); const { getModifyPkConstraintsScriptDtos } = require('./entityHelpers/primaryKeyHelper'); @@ -303,12 +304,14 @@ const getModifyColumnScriptDtos = const modifyDefaultColumnValueScriptDtos = getModifiedDefaultColumnValueScriptDtos({ collection, }); + const modifyColumnCheckConstraintScriptDtos = getModifyColumnCheckConstraintScriptDtos(collection); return [ ...renameColumnScriptDtos, ...updateTypeScriptDtos, ...modifyNotNullScriptDtos, ...modifyDefaultColumnValueScriptDtos, + ...modifyColumnCheckConstraintScriptDtos, ...modifyCommentScriptDtos, ].filter(Boolean); }; diff --git a/forward_engineering/alterScript/alterScriptHelpers/columnHelpers/checkConstraintHelper.js b/forward_engineering/alterScript/alterScriptHelpers/columnHelpers/checkConstraintHelper.js new file mode 100644 index 0000000..77d7918 --- /dev/null +++ b/forward_engineering/alterScript/alterScriptHelpers/columnHelpers/checkConstraintHelper.js @@ -0,0 +1,208 @@ +const _ = require('lodash'); +const { AlterScriptDto } = require('../../types/AlterScriptDto'); +const { + getFullTableName, + wrapInQuotes, + isObjectInDeltaModelActivated, + isParentContainerActivated, +} = require('../../../utils/general'); +const assignTemplates = require('../../../utils/assignTemplates'); +const templates = require('../../../ddlProvider/templates'); + +/** + * @typedef {{ + * name: string, + * expression: string, + * noInherit?: boolean, + * }} ColumnCheckConstraint + * + * @typedef {{ + * old?: ColumnCheckConstraint, + * new?: ColumnCheckConstraint, + * columnName: string, + * isActivated: boolean, + * }} ColumnCheckConstraintHistoryEntry + * */ + +/** + * + * @param {string} [constraintName] + * @param {string} columnName + * @param {string} tableName + * @returns {string} + */ +const getConstraintName = (constraintName, columnName, tableName) => { + return wrapInQuotes(constraintName || `chk_${tableName}.${columnName}`); +}; + +/** + * @param {string} tableName + * @param {string} constraintName + * @return string + * */ +const dropConstraint = (tableName, constraintName) => { + const templateConfig = { + tableName, + constraintName, + }; + return assignTemplates(templates.dropConstraint, templateConfig); +}; + +/** + * @param tableName {string} + * @param constraintName {string} + * @param expression {string} + * @param noInherit {boolean} + * @return string + * */ +const addCheckConstraint = (tableName, constraintName, expression, noInherit = false) => { + const templateConfig = { + tableName, + constraintName, + expression, + noInherit: noInherit ? ' NO INHERIT' : '', + }; + return assignTemplates(templates.addCheckConstraint, templateConfig); +}; + +/** + * @param {Object} collection + * @return {ColumnCheckConstraintHistoryEntry[]} + * */ +const mapColumnCheckConstraintsToChangeHistory = collection => { + const history = []; + + _.toPairs(collection.properties).forEach(([columnName, jsonSchema]) => { + const oldColumnName = jsonSchema.compMod?.oldField?.name || columnName; + const newCheckConstraint = !_.isEmpty(jsonSchema.checkConstraint) + ? _.omit(_.first(jsonSchema.checkConstraint), 'id') + : undefined; + + const oldCheckConstraintValue = collection.role.properties?.[oldColumnName]?.checkConstraint; + const oldCheckConstraint = !_.isEmpty(oldCheckConstraintValue) + ? _.omit(_.first(oldCheckConstraintValue), 'id') + : undefined; + + if (!newCheckConstraint && !oldCheckConstraint) { + return; + } + + history.push({ + columnName, + old: oldCheckConstraint, + new: newCheckConstraint, + isActivated: jsonSchema.isActivated, + }); + }); + + return history; +}; + +/** + * @param {ColumnCheckConstraintHistoryEntry[]} constraintHistory + * @param {string} fullTableName + * @return {AlterScriptDto[]} + * */ +const getDropColumnCheckConstraintScriptDtos = (constraintHistory, fullTableName) => { + return constraintHistory + .filter(historyEntry => historyEntry.old && !historyEntry.new) + .map(historyEntry => { + const wrappedConstraintName = getConstraintName( + historyEntry.old.name, + historyEntry.columnName, + fullTableName, + ); + const script = dropConstraint(fullTableName, wrappedConstraintName); + return AlterScriptDto.getInstance([script], historyEntry.isActivated, true); + }); +}; + +/** + * @param {ColumnCheckConstraintHistoryEntry[]} constraintHistory + * @param {string} fullTableName + * @return {AlterScriptDto[]} + * */ +const getAddColumnCheckConstraintScriptDtos = (constraintHistory, fullTableName) => { + return constraintHistory + .filter(historyEntry => historyEntry.new && !historyEntry.old) + .map(historyEntry => { + const { name, expression, noInherit } = historyEntry.new; + const constraintName = getConstraintName(name, historyEntry.columnName, fullTableName); + + const script = addCheckConstraint(fullTableName, constraintName, expression, noInherit); + return AlterScriptDto.getInstance([script], historyEntry.isActivated); + }); +}; + +/** + * @param {ColumnCheckConstraintHistoryEntry[]} constraintHistory + * @param {string} fullTableName + * @return {AlterScriptDto[]} + * */ +const getUpdateColumnCheckConstraintScriptDtos = (constraintHistory, fullTableName) => { + return constraintHistory + .filter(historyEntry => { + if (historyEntry.old && historyEntry.new) { + const oldExpression = historyEntry.old.expression; + const newExpression = historyEntry.new.expression; + const oldNoInherit = historyEntry.old.noInherit; + const newNoInherit = historyEntry.new.noInherit; + const oldName = historyEntry.old.name; + const newName = historyEntry.new.name; + return oldExpression !== newExpression || oldNoInherit !== newNoInherit || oldName !== newName; + } + return false; + }) + .map(historyEntry => { + const { name: oldConstrainName } = historyEntry.old; + const wrappedOldConstraintName = getConstraintName( + oldConstrainName, + historyEntry.columnName, + fullTableName, + ); + const dropConstraintScript = dropConstraint(fullTableName, wrappedOldConstraintName); + + const { + name: newConstrainName, + expression: newConstraintExpression, + noInherit: newNoInherit, + } = historyEntry.new; + const addConstraintScript = addCheckConstraint( + fullTableName, + getConstraintName(newConstrainName, historyEntry.columnName, fullTableName), + newConstraintExpression, + newNoInherit, + ); + + return [ + AlterScriptDto.getInstance([dropConstraintScript], historyEntry.isActivated, true), + AlterScriptDto.getInstance([addConstraintScript], historyEntry.isActivated, false), + ]; + }) + .flat(); +}; + +/** + * @param {Object} collection + * @return {AlterScriptDto[]} + * */ +const getModifyColumnCheckConstraintScriptDtos = collection => { + const fullTableName = getFullTableName(collection); + const constraintHistory = mapColumnCheckConstraintsToChangeHistory(collection); + + const isContainerActivated = isParentContainerActivated(collection); + const isCollectionActivated = isObjectInDeltaModelActivated(collection); + + const addCheckConstraintScripts = getAddColumnCheckConstraintScriptDtos(constraintHistory, fullTableName); + const dropCheckConstraintScripts = getDropColumnCheckConstraintScriptDtos(constraintHistory, fullTableName); + const updateCheckConstraintScripts = getUpdateColumnCheckConstraintScriptDtos(constraintHistory, fullTableName); + + return [...addCheckConstraintScripts, ...dropCheckConstraintScripts, ...updateCheckConstraintScripts].map(dto => ({ + ...dto, + isActivated: isContainerActivated && isCollectionActivated && dto.isActivated, + })); +}; + +module.exports = { + getModifyColumnCheckConstraintScriptDtos, +}; diff --git a/forward_engineering/alterScript/alterScriptHelpers/entityHelpers/checkConstraintHelper.js b/forward_engineering/alterScript/alterScriptHelpers/entityHelpers/checkConstraintHelper.js index 134f73b..011e34f 100644 --- a/forward_engineering/alterScript/alterScriptHelpers/entityHelpers/checkConstraintHelper.js +++ b/forward_engineering/alterScript/alterScriptHelpers/entityHelpers/checkConstraintHelper.js @@ -15,6 +15,7 @@ const templates = require('../../../ddlProvider/templates'); * id: string, * chkConstrName: string, * constrExpression: string, + * noInherit?: boolean, * }} CheckConstraint * * @typedef {{ @@ -79,13 +80,15 @@ const getDropCheckConstraintScriptDtos = (constraintHistory, fullTableName) => { * @param tableName {string} * @param constraintName {string} * @param expression {expression} + * @param noInherit {boolean} * @return string * */ -const addCheckConstraint = (tableName, constraintName, expression) => { +const addCheckConstraint = (tableName, constraintName, expression, noInherit = false) => { const templateConfig = { tableName, constraintName, expression, + noInherit: noInherit ? ' NO INHERIT' : '', }; return assignTemplates(templates.addCheckConstraint, templateConfig); }; @@ -99,8 +102,8 @@ const getAddCheckConstraintScriptDtos = (constraintHistory, fullTableName) => { return constraintHistory .filter(historyEntry => historyEntry.new && !historyEntry.old) .map(historyEntry => { - const { chkConstrName, constrExpression } = historyEntry.new; - return addCheckConstraint(fullTableName, wrapInQuotes(chkConstrName), constrExpression); + const { chkConstrName, constrExpression, noInherit } = historyEntry.new; + return addCheckConstraint(fullTableName, wrapInQuotes(chkConstrName), constrExpression, noInherit); }) .map(script => AlterScriptDto.getInstance([script], true, false)); }; @@ -116,7 +119,9 @@ const getUpdateCheckConstraintScriptDtos = (constraintHistory, fullTableName) => if (historyEntry.old && historyEntry.new) { const oldExpression = historyEntry.old.constrExpression; const newExpression = historyEntry.new.constrExpression; - return oldExpression !== newExpression; + const oldNoInherit = historyEntry.old.noInherit; + const newNoInherit = historyEntry.new.noInherit; + return oldExpression !== newExpression || oldNoInherit !== newNoInherit; } return false; }) @@ -124,11 +129,16 @@ const getUpdateCheckConstraintScriptDtos = (constraintHistory, fullTableName) => const { chkConstrName: oldConstrainName } = historyEntry.old; const dropConstraintScript = dropConstraint(fullTableName, wrapInQuotes(oldConstrainName)); - const { chkConstrName: newConstrainName, constrExpression: newConstraintExpression } = historyEntry.new; + const { + chkConstrName: newConstrainName, + constrExpression: newConstraintExpression, + noInherit: newNoInherit, + } = historyEntry.new; const addConstraintScript = addCheckConstraint( fullTableName, wrapInQuotes(newConstrainName), newConstraintExpression, + newNoInherit, ); return [ diff --git a/forward_engineering/config.json b/forward_engineering/config.json index cf9c73e..54a8283 100644 --- a/forward_engineering/config.json +++ b/forward_engineering/config.json @@ -245,11 +245,21 @@ "adapters": [ { "dependency": { - "key": "chkConstr", - "valueType": "array" + "type": "or", + "values": [ + { + "key": "chkConstr", + "valueType": "array" + }, + { + "key": "checkConstraint", + "valueType": "array" + } + ] }, "defaultValue": { - "chkConstr": [] + "chkConstr": [], + "checkConstraint": [] } } ] diff --git a/forward_engineering/ddlProvider/ddlHelpers/constraintsHelper.js b/forward_engineering/ddlProvider/ddlHelpers/constraintsHelper.js index edcfcce..a370b6e 100644 --- a/forward_engineering/ddlProvider/ddlHelpers/constraintsHelper.js +++ b/forward_engineering/ddlProvider/ddlHelpers/constraintsHelper.js @@ -100,6 +100,30 @@ const createKeyConstraint = (templates, isParentActivated) => keyData => { }; }; +/** + * Cleans the check constraint expression by removing surrounding parentheses and trimming whitespace. + * @param expression {string} + * @returns string + */ +const cleanCheckConstraint = (expression = '') => _.trim(expression).replace(/^\(([\s\S]*)\)$/, '$1'); + +/** + * Creates an inline check constraint statement. + * @param checkConstraint {{ + * name?: string, + * expression?: string, + * noInherit?: boolean, + * }} + * @returns string + */ +const createInlineCheckConstraint = checkConstraint => { + if (!checkConstraint?.expression) { + return ''; + } + + return ` CHECK (${cleanCheckConstraint(checkConstraint.expression)})${checkConstraint?.noInherit ? ' NO INHERIT' : ''}`; +}; + /** * @param tableName {string} * @param isParentActivated {boolean} @@ -196,4 +220,6 @@ module.exports = { dropKeyConstraint, getConstraintsWarnings, additionalPropertiesForForeignKey, + cleanCheckConstraint, + createInlineCheckConstraint, }; diff --git a/forward_engineering/ddlProvider/ddlProvider.js b/forward_engineering/ddlProvider/ddlProvider.js index d6efb71..01210ea 100644 --- a/forward_engineering/ddlProvider/ddlProvider.js +++ b/forward_engineering/ddlProvider/ddlProvider.js @@ -26,6 +26,8 @@ const { createKeyConstraint, getConstraintsWarnings, additionalPropertiesForForeignKey, + cleanCheckConstraint, + createInlineCheckConstraint, } = require('./ddlHelpers/constraintsHelper'); const keyHelper = require('./ddlHelpers/keyHelper'); const { getFunctionsScript } = require('./ddlHelpers/functionHelper'); @@ -222,6 +224,9 @@ module.exports = (baseProvider, options, app) => { const defaultValue = !_.isUndefined(columnDefinition.default) ? ' DEFAULT ' + decorateDefault(type, columnDefinition.default, isArrayType) : ''; + const checkConstraint = !_.isEmpty(columnDefinition.checkConstraint) + ? ' ' + this.createCheckConstraint(_.first(columnDefinition.checkConstraint)).trim() + : ''; const generatedColumnClause = columnDefinition.dbVersion >= 12 && columnDefinition.generatedColumn && @@ -241,6 +246,7 @@ module.exports = (baseProvider, options, app) => { uniqueKey, collation, defaultValue, + checkConstraint, }), { isActivated: columnDefinition.isActivated, @@ -283,7 +289,7 @@ module.exports = (baseProvider, options, app) => { createCheckConstraint(checkConstraint) { return assignTemplates(templates.checkConstraint, { name: checkConstraint.name ? `CONSTRAINT ${wrapInQuotes(checkConstraint.name)}` : '', - expression: _.trim(checkConstraint.expression).replace(/^\(([\s\S]*)\)$/, '$1'), + expression: cleanCheckConstraint(checkConstraint.expression), noInherit: checkConstraint.noInherit ? ' NO INHERIT' : '', }); }, @@ -630,6 +636,7 @@ module.exports = (baseProvider, options, app) => { uniqueKeyOptions, nullable: columnDefinition.nullable, default: columnDefinition.default, + checkConstraint: jsonSchema.checkConstraint, comment: jsonSchema.refDescription || jsonSchema.description || definitionJsonSchema.description, isActivated: columnDefinition.isActivated, scale: columnDefinition.scale, diff --git a/forward_engineering/ddlProvider/templates.js b/forward_engineering/ddlProvider/templates.js index 172e0a3..d93f9d7 100644 --- a/forward_engineering/ddlProvider/templates.js +++ b/forward_engineering/ddlProvider/templates.js @@ -19,7 +19,7 @@ module.exports = { generatedColumnClause: ' GENERATED ALWAYS AS (${generationExpression}) STORED', columnDefinition: - '${name} ${type}${collation}${generatedColumnClause}${primaryKey}${uniqueKey}${defaultValue}${notNull}', + '${name} ${type}${collation}${generatedColumnClause}${primaryKey}${uniqueKey}${defaultValue}${notNull}${checkConstraint}', checkConstraint: '${name} CHECK (${expression})${noInherit}', @@ -37,7 +37,8 @@ module.exports = { renameColumn: 'ALTER TABLE IF EXISTS ${tableName} RENAME COLUMN ${oldColumnName} TO ${newColumnName};', - addCheckConstraint: 'ALTER TABLE IF EXISTS ${tableName} ADD CONSTRAINT ${constraintName} CHECK (${expression});', + addCheckConstraint: + 'ALTER TABLE IF EXISTS ${tableName} ADD CONSTRAINT ${constraintName} CHECK (${expression})${noInherit};', dropConstraint: 'ALTER TABLE IF EXISTS ${tableName} DROP CONSTRAINT IF EXISTS ${constraintName};', diff --git a/properties_pane/field_level/fieldLevelConfig.json b/properties_pane/field_level/fieldLevelConfig.json index fd7527f..c71417d 100644 --- a/properties_pane/field_level/fieldLevelConfig.json +++ b/properties_pane/field_level/fieldLevelConfig.json @@ -692,6 +692,35 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Alternate Key", "propertyKeyword": "alternateKey", @@ -1305,6 +1334,35 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Alternate Key", "propertyKeyword": "alternateKey", @@ -1879,6 +1937,35 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Alternate Key", "propertyKeyword": "alternateKey", @@ -2492,6 +2579,35 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Alternate Key", "propertyKeyword": "alternateKey", @@ -2637,6 +2753,35 @@ making sure that you maintain a proper JSON format. "propertyType": "details", "template": "textarea" }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Alternate Key", "propertyKeyword": "alternateKey", @@ -3188,6 +3333,35 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Alternate Key", "propertyKeyword": "alternateKey", @@ -3768,6 +3942,35 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Alternate Key", "propertyKeyword": "alternateKey", @@ -3981,6 +4184,35 @@ making sure that you maintain a proper JSON format. "propertyType": "details", "template": "textarea" }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Alternate Key", "propertyKeyword": "alternateKey", @@ -4533,6 +4765,35 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Alternate Key", "propertyKeyword": "alternateKey", @@ -5093,6 +5354,35 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Alternate Key", "propertyKeyword": "alternateKey", @@ -5674,6 +5964,35 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Alternate Key", "propertyKeyword": "alternateKey", @@ -5888,6 +6207,35 @@ making sure that you maintain a proper JSON format. "propertyKeyword": "physicalType", "hidden": true }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Alternate Key", "propertyKeyword": "alternateKey", @@ -6004,6 +6352,35 @@ making sure that you maintain a proper JSON format. "propertyType": "details", "template": "textarea" }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Alternate Key", "propertyKeyword": "alternateKey", @@ -6141,6 +6518,35 @@ making sure that you maintain a proper JSON format. "propertyType": "details", "template": "textarea" }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Alternate Key", "propertyKeyword": "alternateKey", @@ -6276,6 +6682,35 @@ making sure that you maintain a proper JSON format. "addTimestampButton": true, "propertyType": "details", "template": "textarea" + }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] } ], "enum": [ @@ -6329,6 +6764,35 @@ making sure that you maintain a proper JSON format. "addTimestampButton": true, "propertyType": "details", "template": "textarea" + }, + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] } ], "range_udt": [ @@ -6361,6 +6825,35 @@ making sure that you maintain a proper JSON format. "propertyType": "checkbox" }, "default", + { + "propertyName": "Check constraint", + "propertyType": "group", + "propertyKeyword": "checkConstraint", + "enableForReference": true, + "propertyTooltip": "Check constraint", + "groupItemLimit": 1, + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "propertyType": "text" + }, + { + "propertyName": "Expression", + "propertyKeyword": "expression", + "propertyTooltip": "Expression", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "No inherit", + "propertyKeyword": "noInherit", + "propertyTooltip": "No inherit", + "propertyType": "checkbox" + } + ] + }, { "propertyName": "Comments", "propertyKeyword": "description",