Skip to content

Commit

Permalink
HCK-9136: Remove redundant generation type (#153)
Browse files Browse the repository at this point in the history
* HCK-9136: remove generated type property

* HCK-9136: fix column default generation script
  • Loading branch information
serhii-filonenko authored Dec 13, 2024
1 parent dcae3a8 commit 6996562
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 105 deletions.
2 changes: 1 addition & 1 deletion adapter/0.2.22.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
{
"generatedDefaultValue": {
"asIdentity": true,
"generatedType": ""
"generatedType": "ALWAYS"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,13 @@ const getOnNullClause = ({ onNull }) => (onNull ? ' ON NULL' : '');
* @returns {string}
*/
const getGeneratedClause = ({ generatedType, generatedOnNull }) => {
const onNull = getOnNullClause({ onNull: generatedOnNull });

switch (generatedType) {
case GENERATED_TYPE.byDefault: {
return ` GENERATED BY DEFAULT${onNull}`;
}
case GENERATED_TYPE.always: {
return ' GENERATED ALWAYS';
}
default: {
return '';
}
if (generatedType === GENERATED_TYPE.byDefault) {
const onNull = getOnNullClause({ onNull: generatedOnNull });

return ` GENERATED BY DEFAULT${onNull}`;
}

return ' GENERATED ALWAYS';
};

/**
Expand All @@ -81,7 +75,7 @@ const getColumnDefault = ({ type, default: defaultValue, defaultOnNull, generate
const generatedClause = getGeneratedClause({ generatedType, generatedOnNull });
const expressionValue = trim(expression);

if (generatedType && asIdentity && canHaveIdentity({ type }) && !isEmpty(identity)) {
if (asIdentity && canHaveIdentity({ type }) && !isEmpty(identity)) {
const identityOptions = getIdentityOptions(identity);

return `${generatedClause} AS IDENTITY (${identityOptions})`;
Expand Down
98 changes: 7 additions & 91 deletions properties_pane/field_level/fieldLevelConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -850,13 +850,6 @@ making sure that you maintain a proper JSON format.
"propertyKeyword": "generatedDefaultValue",
"propertyType": "block",
"structure": [
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["", "ALWAYS"],
"defaultValue": ""
},
{
"propertyName": "Expression",
"propertyKeyword": "expression",
Expand Down Expand Up @@ -2673,13 +2666,6 @@ making sure that you maintain a proper JSON format.
"propertyKeyword": "generatedDefaultValue",
"propertyType": "block",
"structure": [
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["", "ALWAYS"],
"defaultValue": ""
},
{
"propertyName": "Expression",
"propertyKeyword": "expression",
Expand Down Expand Up @@ -2718,13 +2704,6 @@ making sure that you maintain a proper JSON format.
"propertyKeyword": "generatedDefaultValue",
"propertyType": "block",
"structure": [
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["", "ALWAYS"],
"defaultValue": ""
},
{
"propertyName": "As identity",
"propertyKeyword": "asIdentity",
Expand Down Expand Up @@ -2773,18 +2752,18 @@ making sure that you maintain a proper JSON format.
"propertyKeyword": "generatedDefaultValue",
"propertyType": "block",
"structure": [
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["", "ALWAYS", "BY DEFAULT"],
"defaultValue": ""
},
{
"propertyName": "As identity",
"propertyKeyword": "asIdentity",
"propertyType": "checkbox"
},
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["ALWAYS", "BY DEFAULT"],
"defaultValue": "ALWAYS"
},
{
"propertyName": "On null",
"propertyKeyword": "generatedOnNull",
Expand Down Expand Up @@ -4719,13 +4698,6 @@ making sure that you maintain a proper JSON format.
"propertyKeyword": "generatedDefaultValue",
"propertyType": "block",
"structure": [
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["", "ALWAYS"],
"defaultValue": ""
},
{
"propertyName": "Expression",
"propertyKeyword": "expression",
Expand Down Expand Up @@ -6303,13 +6275,6 @@ making sure that you maintain a proper JSON format.
"propertyKeyword": "generatedDefaultValue",
"propertyType": "block",
"structure": [
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["", "ALWAYS"],
"defaultValue": ""
},
{
"propertyName": "Expression",
"propertyKeyword": "expression",
Expand Down Expand Up @@ -7197,13 +7162,6 @@ making sure that you maintain a proper JSON format.
"propertyKeyword": "generatedDefaultValue",
"propertyType": "block",
"structure": [
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["", "ALWAYS"],
"defaultValue": ""
},
{
"propertyName": "Expression",
"propertyKeyword": "expression",
Expand Down Expand Up @@ -8155,13 +8113,6 @@ making sure that you maintain a proper JSON format.
"propertyKeyword": "generatedDefaultValue",
"propertyType": "block",
"structure": [
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["", "ALWAYS"],
"defaultValue": ""
},
{
"propertyName": "Expression",
"propertyKeyword": "expression",
Expand Down Expand Up @@ -9442,13 +9393,6 @@ making sure that you maintain a proper JSON format.
"propertyKeyword": "generatedDefaultValue",
"propertyType": "block",
"structure": [
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["", "ALWAYS"],
"defaultValue": ""
},
{
"propertyName": "Expression",
"propertyKeyword": "expression",
Expand Down Expand Up @@ -10631,13 +10575,6 @@ making sure that you maintain a proper JSON format.
"propertyKeyword": "generatedDefaultValue",
"propertyType": "block",
"structure": [
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["", "ALWAYS"],
"defaultValue": ""
},
{
"propertyName": "Expression",
"propertyKeyword": "expression",
Expand Down Expand Up @@ -11401,13 +11338,6 @@ making sure that you maintain a proper JSON format.
"propertyKeyword": "generatedDefaultValue",
"propertyType": "block",
"structure": [
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["", "ALWAYS"],
"defaultValue": ""
},
{
"propertyName": "Expression",
"propertyKeyword": "expression",
Expand Down Expand Up @@ -12345,13 +12275,6 @@ making sure that you maintain a proper JSON format.
"propertyKeyword": "generatedDefaultValue",
"propertyType": "block",
"structure": [
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["", "ALWAYS"],
"defaultValue": ""
},
{
"propertyName": "Expression",
"propertyKeyword": "expression",
Expand Down Expand Up @@ -12998,13 +12921,6 @@ making sure that you maintain a proper JSON format.
"propertyKeyword": "generatedDefaultValue",
"propertyType": "block",
"structure": [
{
"propertyName": "Type",
"propertyKeyword": "generatedType",
"propertyType": "select",
"options": ["", "ALWAYS"],
"defaultValue": ""
},
{
"propertyName": "Expression",
"propertyKeyword": "expression",
Expand Down

0 comments on commit 6996562

Please sign in to comment.