使用 nest.js 创建类似 Symfony 的“console Commands” 的可行性?
发布于 6 年前 作者 ibenchu 2179 次浏览 来自 问答

示例:我希望能够编写一个命令,记录需要运行的所有查询以方便用TypeORM更新数据库。

npm run execute-command typeorm:schema:log
ALTER TABLE `scope_group` ADD `name` varchar(255) NOT NULL;
ALTER TABLE `grant` CHANGE `created_at` `created_at` datetime NOT NULL;
ALTER TABLE `grant` CHANGE `updated_at` `updated_at` datetime NOT NULL;
ALTER TABLE `scope` CHANGE `created_at` `created_at` datetime NOT NULL;
ALTER TABLE `scope` CHANGE `updated_at` `updated_at` datetime NOT NULL;

类似: https://symfony.com/doc/current/console.html

有没有类似或者封装好的context: https://docs.nestjs.com/execution-context

1 回复
回到顶部