Naming strategy
  • Specify custom table name
  • Specify custom column name
  • Specify custom foreign column name
  • Specify custom many-to-many junction table name
  • Creating your own NamingStrategy

Creating your own NamingStrategy

If you defined your connection options in the ormconfig file, then you can simply use it and override it following way:
1
import {createConnection, getConnectionOptions} from "typeorm";
2
import {MyNamingStrategy} from "./logger/MyNamingStrategy";
3
4
// getConnectionOptions will read options from your ormconfig file
5
// and return it in connectionOptions object
6
// then you can simply append additional properties to it
7
getConnectionOptions().then(connectionOptions => {
8
return createConnection(Object.assign(connectionOptions, {
9
namingStrategy: new MyNamingStrategy()
10
}))
11
});
Copied!
Naming Strategy is a subject to change. Expect detailed documentation once its API gets stabilized.