Bug: Not recognize factories
Spartaques opened this issue · 1 comments
Spartaques commented
tada5hi commented
If you do not use one of the seeder methods (runSeeder
runSeeders
) or the cli, you have to import the seeder factory file manually, somewhere in the import chain of your entrypoint, to register the factory.
In your case you could just add the following line to your controller file:
import '../../database/factories/user.factory';
If you want to execute the seeder from the code base instead of the cli, you must also register the data-source or data-source options to the library.
Therefore use the setDataSource
or setDataSourceOptions
method, to register your data-source (src/common/typeorm/data.source.ts) or data-source-options (src/config/mysql.ts).