import { NamingStrategyInterface , DefaultNamingStrategy , Table } from 'typeorm' ; const tableName = ( tableOrName ) => ( typeof tableOrName === 'string' ? tableOrName : tableOrName . name ) . replace ( /-/g , '_' ) . replace ( / /g , '' ) ; export class MdsNamingStrategy extends DefaultNamingStrategy implements NamingStrategyInterface { primaryKeyName ( tableOrName , columnNames ) { return [ tableName ( tableOrName ) , 'pkey' ] . join ( '_' ) ; } indexName ( tableOrName , columnNames , where ? ) { return [ 'idx' , ... columnNames , tableName ( tableOrName ) ] . join ( '_' ) ; } uniqueConstraintName ( tableOrName , columnNames ) { return [ 'uc' , ... columnNames , tableName ( tableOrName ) ] . join ( '_' ) ; } }