I am currently utilizing TypeORM with the following setup in my ormconfig.json file:
{
"type": "mysql",
"host": "localhost",
"port": 3306,
"username": "root",
"password": "my-secret-pw",
"database": "mytestdb",
}
All of my Entity files are saved in the directory ./src/bar/entity. However, I keep encountering the same error message:
RepositoryNotFoundError: No repository for "myTable" was found. It seems like this entity is not registered in the current "default" connection?
The Entity is only recognized when I manually include the directory path in the configuration file like so:
{
...
"entities": ["src/bar/entity/**/*.ts"]
}
For instance, my Entity is structured as follows:
@Entity('myTable')
export default class MyTable {
@PrimaryGeneratedColumn()
public id: number;
...
Is there a way to enable TypeORM to automatically detect these entities without having to set them manually in the configuration file? Any advice would be greatly appreciated.