relationId, ralationName none caseing (#280)

This commit is contained in:
kononnable 2020-12-31 20:10:12 +01:00
parent 6a2ac2f063
commit a4df1141c4

View File

@ -22,9 +22,7 @@ export function relationIdName(
const isRelationToMany =
relation.relationType === "OneToMany" ||
relation.relationType === "ManyToMany";
let newColumnName = changeCase.camelCase(
columnOldName.replace(/[0-9]$/, "")
);
let newColumnName = columnOldName.replace(/[0-9]$/, "");
if (!Number.isNaN(parseInt(newColumnName[newColumnName.length - 1], 10))) {
newColumnName = newColumnName.substring(0, newColumnName.length - 1);
@ -45,9 +43,7 @@ export function relationName(relation: Relation, owner?: Entity): string {
const isRelationToMany =
relation.relationType === "OneToMany" ||
relation.relationType === "ManyToMany";
let newColumnName = changeCase.camelCase(
columnOldName.replace(/[0-9]$/, "")
);
let newColumnName = columnOldName.replace(/[0-9]$/, "");
if (
newColumnName.toLowerCase().endsWith("id") &&