Skip to content

Commit

Permalink
HCK-6081: fix generate of key property value in sample data
Browse files Browse the repository at this point in the history
  • Loading branch information
serhii-filonenko committed May 24, 2024
1 parent 1de7e24 commit f14c9a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 1 addition & 3 deletions forward_engineering/services/statements/insertStatements.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ const getInsertScriptForCollection = ({ jsonData, collection }) => {
);

const insertionPath = getKeySpaceReference(collection);
const isKeyGeneratedWithFakerFunction = collection?.properties?.[keyPropertyName]?.fakerFunction;
const parseJsonData = JSON.parse(jsonData);
const keyFakedValue = isKeyGeneratedWithFakerFunction ? parseJsonData[keyPropertyName] : '';
const { [keyPropertyName]: keyProperty, ...jsonDataBody } = parseJsonData;
const sampledKey = getKeyFieldSample(keyFakedValue);
const sampledKey = getKeyFieldSample(parseJsonData[keyPropertyName]);

return `INSERT INTO ${insertionPath} (KEY, VALUE)\n\tVALUES("${sampledKey}",${JSON.stringify(jsonDataBody, null, '\t')});`;
};
Expand Down
1 change: 1 addition & 0 deletions localization/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"COLLECTION_SCHEMA_DEFINITION_TYPE": "document",
"PLUGIN_MANAGER___CUSTOM_PROPERTIES_DESCRIPTION": "Custom properties for Couchbase",
"DATABASE_CONNECTIONS___CONTAINER_TYPE_NAME": "Bucket",
"CENTRAL_PANE___FE_SCRIPT": "Couchbase Script",

"TYPE": {
"document": "object"
Expand Down

0 comments on commit f14c9a9

Please sign in to comment.