Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
columnName(
propertyName: string,
customName: string,
embeddedPrefixes: string[],
): string {
return (
snakeCase(embeddedPrefixes.join('_')) +
(customName ? customName : snakeCase(propertyName))
);
}
columnName(propertyName: string, customName?: string, embeddedPrefixes: string[] = []): string {
return (
snakeCase(embeddedPrefixes.join('_')) + (customName ? customName : snakeCase(propertyName))
);
}
uniqueConstraintName(tableOrName: string, columnNames: string[]): string {
return snakeCase('uq_' + tableOrName + columnNames.map(column => '_' + column));
}
columnName(propertyName: string, customName: string, embeddedPrefixes: string[]): string {
return snakeCase(embeddedPrefixes.join('_')) + (customName ? customName : snakeCase(propertyName));
}
joinTableName(
firstTableName: string,
secondTableName: string,
firstPropertyName: string,
_secondPropertyName: string,
): string {
return snakeCase(
firstTableName +
'_' +
firstPropertyName.replace(/\./gi, '_') +
'_' +
secondTableName,
);
}
foreignKeyName(tableOrName: string, columnNames: string[]): string {
return snakeCase('fk_' + tableOrName + columnNames.map(column => '_' + column));
}
joinColumnName(relationName: string, referencedColumnName: string): string {
return snakeCase(relationName + '_' + referencedColumnName);
}
protected formatAliasField(alias: string, field: string): string {
switch (this.namingStrategy) {
case LoaderNamingStrategyEnum.SNAKECASE:
return `${alias}_${snakeCase(field)}`;
case LoaderNamingStrategyEnum.CAMELCASE:
return `${alias}_${field}`;
default:
return `${alias}_${field}`;
}
}
classTableInheritanceParentColumnName(
parentTableName: any,
parentTableIdPropertyName: any,
): string {
return snakeCase(parentTableName + '_' + parentTableIdPropertyName);
}
}
joinTableColumnName(tableName: string, propertyName: string, columnName?: string): string {
return snakeCase(`${tableName}_${columnName ? columnName : propertyName}`);
}