douglas-treadwell / sequelize-cli-typescript

The Sequelize CLI
MIT License
48 stars 21 forks source link

can't run seeders #4

Open mossaabzaroui opened 6 years ago

mossaabzaroui commented 6 years ago

Hello,

I have succeded to run migrations from the migrations-compiled-path but for seeders there is no option like seeders-compiled-path and seeders-source-path. i have create a seed file with this: command : /var/www/project/src/node_modules/.bin/sequelize seed:generate --name test => seeders folder at "/var/www/project/src/entities/seeders" already exists. New seed was created at /var/www/project/src/entities/seeders/20180316084809-test.ts .

When i run db:seed:all i have this error : File: 20180316084809-test.ts does not match pattern: /.js$/ No seeders found.

Here is my .sequelizerc file : module.exports = { 'config': path.resolve('src', 'entities/database.ts'), 'models-path': path.resolve('src', 'entities'), 'seeders-path': path.resolve('src', 'entities/seeders'), 'migrations-source-path': path.resolve('src', 'entities/migrations'), 'migrations-compiled-path': path.resolve('dist', 'entities/migrations') }

It works fine for migrations but not seeders. @douglas-treadwell do you have an idea how i can fix this ?

Thank you.

Befkadu1 commented 5 years ago

You probably need to change 20180316084809-test.ts to 20180316084809-test.js

himanshugogroup commented 7 months ago

First add seeder text in file name and second compile project to js eg; npx tsc -outDir ./build-migrations ./src/**/*.ts

Don't forget to exclude build-migrations as it only will be used while migration/seed running