diff --git a/forward_engineering/alterScript/alterScriptFromDeltaHelper.js b/forward_engineering/alterScript/alterScriptFromDeltaHelper.js index 7c33454..7a1f9e5 100644 --- a/forward_engineering/alterScript/alterScriptFromDeltaHelper.js +++ b/forward_engineering/alterScript/alterScriptFromDeltaHelper.js @@ -120,7 +120,7 @@ const getAlterCollectionsScriptDtos = ({ .filter(Boolean) .map(item => Object.values(item.properties)[0]) .filter(collection => !collection.compMod) - .flatMap(getModifyColumnScriptDtos(app)); + .flatMap(getModifyColumnScriptDtos({app, dbVersion, modelDefinitions, internalDefinitions, externalDefinitions})); return [ ...createCollectionsScriptDtos, diff --git a/forward_engineering/alterScript/alterScriptHelpers/alterEntityHelper.js b/forward_engineering/alterScript/alterScriptHelpers/alterEntityHelper.js index 87c3ae8..fd85bdf 100644 --- a/forward_engineering/alterScript/alterScriptHelpers/alterEntityHelper.js +++ b/forward_engineering/alterScript/alterScriptHelpers/alterEntityHelper.js @@ -89,53 +89,63 @@ const getModifyCollectionScriptDtos = (app) => (collection) => { ].filter(Boolean); } +/** + * @return {(collection: Object, predicate: ([name: string, jsonSchema: Object]) => boolean) => AlterScriptDto[]} + * */ +const getAddColumnsByConditionScriptDtos = ({app, dbVersion, modelDefinitions, internalDefinitions, externalDefinitions}) => + (collection, predicate) => { + const _ = app.require('lodash'); + const {getEntityName, getNamePrefixedWithSchemaName} = require('../../utils/general')(_); + const {createColumnDefinitionBySchema} = require('./createColumnDefinition')(app); + const ddlProvider = require('../../ddlProvider/ddlProvider')(null, null, app); + const {getDefinitionByReference} = app.require('@hackolade/ddl-fe-utils'); + + const collectionSchema = {...collection, ...(_.omit(collection?.role, 'properties') || {})}; + const tableName = getEntityName(collectionSchema); + const schemaName = collectionSchema.compMod?.keyspaceName; + const fullName = getNamePrefixedWithSchemaName(tableName, schemaName); + const schemaData = {schemaName, dbVersion}; + + return _.toPairs(collection.properties) + .filter(([name, jsonSchema]) => predicate([name, jsonSchema])) + .map(([name, jsonSchema]) => { + const definitionJsonSchema = getDefinitionByReference({ + propertySchema: jsonSchema, + modelDefinitions, + internalDefinitions, + externalDefinitions, + }); + + return createColumnDefinitionBySchema({ + name, + jsonSchema, + parentJsonSchema: collectionSchema, + ddlProvider, + schemaData, + definitionJsonSchema, + }); + }) + .map(ddlProvider.convertColumnDefinition) + .map(columnDefinition => ddlProvider.addColumn(fullName, columnDefinition)) + .map(addColumnScript => AlterScriptDto.getInstance([addColumnScript], true, false)) + .filter(Boolean); + }; + /** * @return {(collection: Object) => AlterScriptDto[]} * */ const getAddColumnScriptDtos = ({app, dbVersion, modelDefinitions, internalDefinitions, externalDefinitions}) => collection => { - const _ = app.require('lodash'); - const {getEntityName, getNamePrefixedWithSchemaName} = require('../../utils/general')(_); - const {createColumnDefinitionBySchema} = require('./createColumnDefinition')(app); - const ddlProvider = require('../../ddlProvider/ddlProvider')(null, null, app); - const {getDefinitionByReference} = app.require('@hackolade/ddl-fe-utils'); - - const collectionSchema = {...collection, ...(_.omit(collection?.role, 'properties') || {})}; - const tableName = getEntityName(collectionSchema); - const schemaName = collectionSchema.compMod?.keyspaceName; - const fullName = getNamePrefixedWithSchemaName(tableName, schemaName); - const schemaData = {schemaName, dbVersion}; - - return _.toPairs(collection.properties) - .filter(([name, jsonSchema]) => !jsonSchema.compMod) - .map(([name, jsonSchema]) => { - const definitionJsonSchema = getDefinitionByReference({ - propertySchema: jsonSchema, - modelDefinitions, - internalDefinitions, - externalDefinitions, - }); - - return createColumnDefinitionBySchema({ - name, - jsonSchema, - parentJsonSchema: collectionSchema, - ddlProvider, - schemaData, - definitionJsonSchema, - }); - }) - .map(ddlProvider.convertColumnDefinition) - .map(columnDefinition => ddlProvider.addColumn(fullName, columnDefinition)) - .map(addColumnScript => AlterScriptDto.getInstance([addColumnScript], true, false)) - .filter(Boolean); - }; + return getAddColumnsByConditionScriptDtos({ + app, dbVersion, modelDefinitions, internalDefinitions, externalDefinitions + })(collection, ([name, jsonSchema]) => !jsonSchema.compMod); + } /** - * @return {(collection: Object) => AlterScriptDto[]} + * @return {(collection: Object, predicate: ([name: string, jsonSchema: Object]) => boolean) => AlterScriptDto[]} * */ -const getDeleteColumnScriptDtos = app => collection => { +const getDeleteColumnsByConditionScriptDtos = app => (collection, predicate) => { const _ = app.require('lodash'); const ddlProvider = require('../../ddlProvider/ddlProvider')(null, null, app); const {getEntityName, getNamePrefixedWithSchemaName, wrapInQuotes} = require('../../utils/general')(_); @@ -146,7 +156,7 @@ const getDeleteColumnScriptDtos = app => collection => { const fullTableName = getNamePrefixedWithSchemaName(tableName, schemaName); return _.toPairs(collection.properties) - .filter(([name, jsonSchema]) => !jsonSchema.compMod) + .filter(([name, jsonSchema]) => predicate([name, jsonSchema])) .map(([name]) => { const columnNameForDDL = wrapInQuotes(name); return ddlProvider.dropColumn(fullTableName, columnNameForDDL) @@ -158,11 +168,66 @@ const getDeleteColumnScriptDtos = app => collection => { /** * @return {(collection: Object) => AlterScriptDto[]} * */ -const getModifyColumnScriptDtos = app => collection => { +const getDeleteColumnScriptDtos = app => collection => { + return getDeleteColumnsByConditionScriptDtos(app)(collection, ([name, jsonSchema]) => !jsonSchema.compMod) +}; + +/** + * @return {(collection: Object) => Array} + * */ +const getDropAndRecreateColumnsScriptDtos = ({app, dbVersion, modelDefinitions, internalDefinitions, externalDefinitions}) => + (collection) => { + const _ = app.require('lodash'); + + return _.toPairs(collection.properties) + .filter(([name, jsonSchema]) => { + const oldName = jsonSchema.compMod.oldField.name; + const oldProperty = collection.role.properties[oldName]; + + const didGeneratedColumnChange = oldProperty.generatedColumn !== jsonSchema.generatedColumn + || oldProperty.columnGenerationExpression !== jsonSchema.columnGenerationExpression; + // all conditions that require drop-and-recreate go here + return didGeneratedColumnChange; + }) + .flatMap(([name, jsonSchema]) => { + const collectionWithJustThisProperty = { + ...collection, + properties: _.fromPairs([ + [name, jsonSchema] + ]), + } + const deleteColumnsScriptDtos = getDeleteColumnsByConditionScriptDtos(app)(collectionWithJustThisProperty, () => true); + const addColumnsScriptDtos = getAddColumnsByConditionScriptDtos({ + app, dbVersion, modelDefinitions, internalDefinitions, externalDefinitions + })(collectionWithJustThisProperty, () => true); + + return [ + ...deleteColumnsScriptDtos, + ...addColumnsScriptDtos, + ] + }) + .filter(Boolean); + } + +/** + * @return {(collection: Object) => AlterScriptDto[]} + * */ +const getModifyColumnScriptDtos = ( + {app, dbVersion, modelDefinitions, internalDefinitions, externalDefinitions} +) => collection => { const _ = app.require('lodash'); const ddlProvider = require('../../ddlProvider/ddlProvider')(null, null, app); const renameColumnScriptDtos = getRenameColumnScriptDtos(_, ddlProvider)(collection); + + const dropAndRecreateScriptDtos = getDropAndRecreateColumnsScriptDtos({app, dbVersion, modelDefinitions, internalDefinitions, externalDefinitions})(collection); + if (dropAndRecreateScriptDtos.length) { + return [ + ...renameColumnScriptDtos, + ...dropAndRecreateScriptDtos, + ].filter(Boolean); + } + const updateTypeScriptDtos = getUpdateTypesScriptDtos(_, ddlProvider)(collection); const modifyNotNullScriptDtos = getModifyNonNullColumnsScriptDtos(_, ddlProvider)(collection); const modifyCommentScriptDtos = getModifiedCommentOnColumnScriptDtos(_, ddlProvider)(collection); diff --git a/forward_engineering/ddlProvider/ddlProvider.js b/forward_engineering/ddlProvider/ddlProvider.js index a89e126..80e3a9b 100644 --- a/forward_engineering/ddlProvider/ddlProvider.js +++ b/forward_engineering/ddlProvider/ddlProvider.js @@ -258,11 +258,17 @@ module.exports = (baseProvider, options, app) => { const defaultValue = !_.isUndefined(columnDefinition.default) ? ' DEFAULT ' + decorateDefault(type, columnDefinition.default, isArrayType) : ''; + const generatedColumnClause = columnDefinition.generatedColumn && columnDefinition.columnGenerationExpression + ? assignTemplates(templates.generatedColumnClause, { + generationExpression: columnDefinition.columnGenerationExpression, + }) + : ''; return commentIfDeactivated( assignTemplates(templates.columnDefinition, { name: wrapInQuotes(columnDefinition.name), type: decorateType(type, columnDefinition), + generatedColumnClause, notNull, primaryKey, uniqueKey, @@ -670,6 +676,8 @@ module.exports = (baseProvider, options, app) => { timezone, intervalOptions, dbVersion, + generatedColumn: Boolean(jsonSchema.generatedColumn), + columnGenerationExpression: jsonSchema.columnGenerationExpression, }; }, diff --git a/forward_engineering/ddlProvider/templates.js b/forward_engineering/ddlProvider/templates.js index a3e933c..7b9495d 100644 --- a/forward_engineering/ddlProvider/templates.js +++ b/forward_engineering/ddlProvider/templates.js @@ -16,7 +16,9 @@ module.exports = { '${partitionOf} ${openParenthesis}${keyConstraints}${checkConstraints}${foreignKeyConstraints}\n' + '${closeParenthesis}${options};\n\n${comment}${columnDescriptions}', - columnDefinition: '${name} ${type}${collation}${primaryKey}${uniqueKey}${defaultValue}${notNull}', + generatedColumnClause: ' GENERATED ALWAYS AS (${generationExpression}) STORED', + + columnDefinition: '${name} ${type}${collation}${generatedColumnClause}${primaryKey}${uniqueKey}${defaultValue}${notNull}', checkConstraint: '${name} CHECK (${expression})${noInherit}', diff --git a/properties_pane/field_level/fieldLevelConfig.json b/properties_pane/field_level/fieldLevelConfig.json index 6e7f56d..ea12cb6 100644 --- a/properties_pane/field_level/fieldLevelConfig.json +++ b/properties_pane/field_level/fieldLevelConfig.json @@ -189,6 +189,65 @@ making sure that you maintain a proper JSON format. ] } }, + { + "propertyName": "Generated column", + "propertyKeyword": "generatedColumn", + "propertyTooltip": "A generated column is a special column that is always computed from other columns", + "propertyType": "checkbox", + "dependency": { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + }, + { + "propertyName": "Generation expression", + "propertyKeyword": "columnGenerationExpression", + "propertyTooltip": "An SQL statement for computing values for this column", + "propertyType": "details", + "template": "textarea", + "markdown": false, + "dependency": { + "type": "and", + "values": [ + { + "key": "generatedColumn", + "value": true + }, + { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + ] + } + }, { "propertyName": "Not null", "propertyKeyword": "required", @@ -732,6 +791,65 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Generated column", + "propertyKeyword": "generatedColumn", + "propertyTooltip": "A generated column is a special column that is always computed from other columns", + "propertyType": "checkbox", + "dependency": { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + }, + { + "propertyName": "Generation expression", + "propertyKeyword": "columnGenerationExpression", + "propertyTooltip": "An SQL statement for computing values for this column", + "propertyType": "details", + "template": "textarea", + "markdown": false, + "dependency": { + "type": "and", + "values": [ + { + "key": "generatedColumn", + "value": true + }, + { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + ] + } + }, { "propertyName": "Not null", "propertyKeyword": "required", @@ -1213,6 +1331,65 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Generated column", + "propertyKeyword": "generatedColumn", + "propertyTooltip": "A generated column is a special column that is always computed from other columns", + "propertyType": "checkbox", + "dependency": { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + }, + { + "propertyName": "Generation expression", + "propertyKeyword": "columnGenerationExpression", + "propertyTooltip": "An SQL statement for computing values for this column", + "propertyType": "details", + "template": "textarea", + "markdown": false, + "dependency": { + "type": "and", + "values": [ + { + "key": "generatedColumn", + "value": true + }, + { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + ] + } + }, { "propertyName": "Not null", "propertyKeyword": "required", @@ -1737,6 +1914,65 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Generated column", + "propertyKeyword": "generatedColumn", + "propertyTooltip": "A generated column is a special column that is always computed from other columns", + "propertyType": "checkbox", + "dependency": { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + }, + { + "propertyName": "Generation expression", + "propertyKeyword": "columnGenerationExpression", + "propertyTooltip": "An SQL statement for computing values for this column", + "propertyType": "details", + "template": "textarea", + "markdown": false, + "dependency": { + "type": "and", + "values": [ + { + "key": "generatedColumn", + "value": true + }, + { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + ] + } + }, { "propertyName": "Not null", "propertyKeyword": "required", @@ -2188,6 +2424,65 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Generated column", + "propertyKeyword": "generatedColumn", + "propertyTooltip": "A generated column is a special column that is always computed from other columns", + "propertyType": "checkbox", + "dependency": { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + }, + { + "propertyName": "Generation expression", + "propertyKeyword": "columnGenerationExpression", + "propertyTooltip": "An SQL statement for computing values for this column", + "propertyType": "details", + "template": "textarea", + "markdown": false, + "dependency": { + "type": "and", + "values": [ + { + "key": "generatedColumn", + "value": true + }, + { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + ] + } + }, { "propertyName": "Not null", "propertyKeyword": "required", @@ -2243,6 +2538,65 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Generated column", + "propertyKeyword": "generatedColumn", + "propertyTooltip": "A generated column is a special column that is always computed from other columns", + "propertyType": "checkbox", + "dependency": { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + }, + { + "propertyName": "Generation expression", + "propertyKeyword": "columnGenerationExpression", + "propertyTooltip": "An SQL statement for computing values for this column", + "propertyType": "details", + "template": "textarea", + "markdown": false, + "dependency": { + "type": "and", + "values": [ + { + "key": "generatedColumn", + "value": true + }, + { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + ] + } + }, { "propertyName": "Not null", "propertyKeyword": "required", @@ -2719,6 +3073,65 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Generated column", + "propertyKeyword": "generatedColumn", + "propertyTooltip": "A generated column is a special column that is always computed from other columns", + "propertyType": "checkbox", + "dependency": { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + }, + { + "propertyName": "Generation expression", + "propertyKeyword": "columnGenerationExpression", + "propertyTooltip": "An SQL statement for computing values for this column", + "propertyType": "details", + "template": "textarea", + "markdown": false, + "dependency": { + "type": "and", + "values": [ + { + "key": "generatedColumn", + "value": true + }, + { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + ] + } + }, { "propertyName": "Not null", "propertyKeyword": "required", @@ -3248,6 +3661,65 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Generated column", + "propertyKeyword": "generatedColumn", + "propertyTooltip": "A generated column is a special column that is always computed from other columns", + "propertyType": "checkbox", + "dependency": { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + }, + { + "propertyName": "Generation expression", + "propertyKeyword": "columnGenerationExpression", + "propertyTooltip": "An SQL statement for computing values for this column", + "propertyType": "details", + "template": "textarea", + "markdown": false, + "dependency": { + "type": "and", + "values": [ + { + "key": "generatedColumn", + "value": true + }, + { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + ] + } + }, { "propertyName": "Not null", "propertyKeyword": "required", @@ -3309,6 +3781,65 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Generated column", + "propertyKeyword": "generatedColumn", + "propertyTooltip": "A generated column is a special column that is always computed from other columns", + "propertyType": "checkbox", + "dependency": { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + }, + { + "propertyName": "Generation expression", + "propertyKeyword": "columnGenerationExpression", + "propertyTooltip": "An SQL statement for computing values for this column", + "propertyType": "details", + "template": "textarea", + "markdown": false, + "dependency": { + "type": "and", + "values": [ + { + "key": "generatedColumn", + "value": true + }, + { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + ] + } + }, { "propertyName": "Not null", "propertyKeyword": "required", @@ -3765,6 +4296,65 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Generated column", + "propertyKeyword": "generatedColumn", + "propertyTooltip": "A generated column is a special column that is always computed from other columns", + "propertyType": "checkbox", + "dependency": { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + }, + { + "propertyName": "Generation expression", + "propertyKeyword": "columnGenerationExpression", + "propertyTooltip": "An SQL statement for computing values for this column", + "propertyType": "details", + "template": "textarea", + "markdown": false, + "dependency": { + "type": "and", + "values": [ + { + "key": "generatedColumn", + "value": true + }, + { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + ] + } + }, { "propertyName": "Not null", "propertyKeyword": "required", @@ -4242,6 +4832,65 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Generated column", + "propertyKeyword": "generatedColumn", + "propertyTooltip": "A generated column is a special column that is always computed from other columns", + "propertyType": "checkbox", + "dependency": { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + }, + { + "propertyName": "Generation expression", + "propertyKeyword": "columnGenerationExpression", + "propertyTooltip": "An SQL statement for computing values for this column", + "propertyType": "details", + "template": "textarea", + "markdown": false, + "dependency": { + "type": "and", + "values": [ + { + "key": "generatedColumn", + "value": true + }, + { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + ] + } + }, { "propertyName": "Not null", "propertyKeyword": "required", @@ -4698,6 +5347,65 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Generated column", + "propertyKeyword": "generatedColumn", + "propertyTooltip": "A generated column is a special column that is always computed from other columns", + "propertyType": "checkbox", + "dependency": { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + }, + { + "propertyName": "Generation expression", + "propertyKeyword": "columnGenerationExpression", + "propertyTooltip": "An SQL statement for computing values for this column", + "propertyType": "details", + "template": "textarea", + "markdown": false, + "dependency": { + "type": "and", + "values": [ + { + "key": "generatedColumn", + "value": true + }, + { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + ] + } + }, { "propertyName": "Not null", "propertyKeyword": "required", @@ -4792,6 +5500,65 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Generated column", + "propertyKeyword": "generatedColumn", + "propertyTooltip": "A generated column is a special column that is always computed from other columns", + "propertyType": "checkbox", + "dependency": { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + }, + { + "propertyName": "Generation expression", + "propertyKeyword": "columnGenerationExpression", + "propertyTooltip": "An SQL statement for computing values for this column", + "propertyType": "details", + "template": "textarea", + "markdown": false, + "dependency": { + "type": "and", + "values": [ + { + "key": "generatedColumn", + "value": true + }, + { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + ] + } + }, { "propertyName": "Not null", "propertyKeyword": "required", @@ -4844,6 +5611,65 @@ making sure that you maintain a proper JSON format. "propertyType": "details", "template": "textarea" }, + { + "propertyName": "Generated column", + "propertyKeyword": "generatedColumn", + "propertyTooltip": "A generated column is a special column that is always computed from other columns", + "propertyType": "checkbox", + "dependency": { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + }, + { + "propertyName": "Generation expression", + "propertyKeyword": "columnGenerationExpression", + "propertyTooltip": "An SQL statement for computing values for this column", + "propertyType": "details", + "template": "textarea", + "markdown": false, + "dependency": { + "type": "and", + "values": [ + { + "key": "generatedColumn", + "value": true + }, + { + "type": "not", + "values": { + "type": "or", + "values": [ + { + "level": "model", + "key": "dbVersion", + "value": "v10.x" + }, + { + "level": "model", + "key": "dbVersion", + "value": "v11.x" + } + ] + } + } + ] + } + }, { "propertyName": "Not null", "propertyKeyword": "required",