'How to seed a one file only with sequelize-cli?

sequqlize-cli db:seed:all is working fine, but how to seed only one file? Tried to db:seed:[name-that-i-gave-with-create-command] and db:seed:[full-path-to-seed-file.js] but it doesnt work. It outputs nothing. Docs say sequelize db:seed Run specified seeder But how to do that?



Solution 1:[1]

To run a specific seed indicate --seed <seed_file_nams.js>:

sequelize db:seed --seed my_seeder_file.js

Solution 2:[2]

We can launch a specific seeder via npx sequelize-cli with the following command :

npx sequelize-cli db:seed --seed my-seeder-file.js

Solution 3:[3]

To run a specific seed indicate file name (seeder_file.js), also seeders directory and config path:

sequelize db:seed --seed seeder_file.js --config src/config/db.js --seeders-path src/seeders

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anatoly
Solution 2 Jocelyn Nsa
Solution 3 Stephanie Saavedra Ayarde