sequelize-cli 如何运行单个seeder
在sequelize-cli 中, sequelize db:seed:all
会执行 seeders 文件夹中所有的 seeder 。
如果只想执行某一个seeder , 比如 20180906061439-user2.js
文件,在命令行中该如何写?
$ sequelize --help
Sequelize CLI [Node: 8.9.0, CLI: 3.2.0, ORM: 4.8.0]
WARNING: This version of Sequelize CLI is not fully compatible with Sequelize v4. https://github.com/sequelize/cli#sequelize-support
Commands:
db:migrate Run pending migrations
db:migrate:schema:timestamps:add Update migration table to have timestamps
db:migrate:status List the status of all migrations
db:migrate:undo Reverts a migration
db:migrate:undo:all Revert all migrations ran
db:seed Run specified seeder
db:seed:undo Deletes data from the database
db:seed:all Run every seeder
db:seed:undo:all Deletes data from the database
db:create Create database specified by configuration
db:drop Drop database specified by configuration
init Initializes project
init:config Initializes configuration
init:migrations Initializes migrations
init:models Initializes models
init:seeders Initializes seeders
migration:generate Generates a new migration file [aliases: migration:create]
model:generate Generates a model and its migration [aliases: model:create]
seed:generate Generates a new seed file [aliases: seed:create]
Options:
--version Show version number [boolean]
--help Show help [boolean]
上面显示db:seed
命令会运行某一个seeder , 可是具体该如何用呢?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看对应操作的帮助,这里面有说明,在对应的参数下边跟上你的seeder种子文件,就可以单个生成,也可以跟多个
npx sequelize db:seed --seed 20191105081904-user.js
兄弟,你也在用sequelize-cli吗,我也是,能加个Q Q一起聊下吗,目录在用这个的人很少,有问题都很难找人交流
sequlize 群 752604632