Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion forward_engineering/helpers/constraintsHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = app => {

const createKeyConstraint = (templates, terminator, isParentActivated) => keyData => {
const partition = keyData.partition ? ` ON [${keyData.partition}]` : '';
const columnMapToString = ({ name, order }) => `[${name}] ${order}`.trim();
const columnMapToString = ({ name }) => `[${name}]`.trim();

const isAllColumnsDeactivated = checkAllKeysDeactivated(keyData.columns);

Expand Down
13 changes: 0 additions & 13 deletions forward_engineering/helpers/keyHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,13 @@ module.exports = app => {
}
};

const getOrder = order => {
if (_.toLower(order) === 'asc') {
return 'ASC';
} else if (_.toLower(order) === 'desc') {
return 'DESC';
} else {
return '';
}
};

const hydrateUniqueOptions = (options, columnName, isActivated) =>
clean({
keyType: 'UNIQUE',
name: options['constraintName'],
columns: [
{
name: columnName,
order: getOrder(options['order']),
isActivated: isActivated,
},
],
Expand All @@ -108,7 +97,6 @@ module.exports = app => {
columns: [
{
name: columnName,
order: getOrder(options['order']),
isActivated: isActivated,
},
],
Expand Down Expand Up @@ -143,7 +131,6 @@ module.exports = app => {
return keys.map(key => {
return {
name: findName(key.keyId, jsonSchema.properties),
order: key.type === 'descending' ? 'DESC' : 'ASC',
isActivated: checkIfActivated(key.keyId, jsonSchema.properties),
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const PRIMARY_KEY = 'PRIMARY KEY';
const reverseCompositeKeys = keyConstraintsInfo => {
const keyCompositionStatuses = getKeyConstraintsCompositionStatuses(keyConstraintsInfo);
return keyConstraintsInfo.reduce((reversedKeys, keyConstraintInfo) => {
const { columnName, constraintName, constraintType, isDescending } = keyConstraintInfo;
const { columnName, constraintName, constraintType } = keyConstraintInfo;
const compositionStatus = keyCompositionStatuses[constraintName];
const existingReversedKey = reversedKeys[constraintName];
const keyType = constraintType === PRIMARY_KEY ? 'compositePrimaryKey' : 'compositeUniqueKey';
Expand All @@ -24,7 +24,6 @@ const reverseCompositeKeys = keyConstraintsInfo => {
[keyType]: [
{
name: columnName,
type: isDescending ? 'descending' : 'ascending',
},
],
},
Expand All @@ -44,7 +43,6 @@ const reverseCompositeKeys = keyConstraintsInfo => {
...existingReversedKey[keyType],
{
name: columnName,
type: isDescending ? 'descending' : 'ascending',
},
],
},
Expand Down