Skip to content

Instantly share code, notes, and snippets.

@biern
biern / snakeNaming.ts
Last active November 22, 2019 12:33 — forked from recurrence/snake_naming.ts
TypeORM Snake Case Naming Strategy
import { NamingStrategyInterface, DefaultNamingStrategy } from 'typeorm';
import { snakeCase } from 'typeorm/util/StringUtils';
export class SnakeNamingStrategy extends DefaultNamingStrategy
implements NamingStrategyInterface {
tableName(className: string, customName: string): string {
return customName ? customName : snakeCase(className);
}
columnName(