Skip to content

Conversation

@GoooIce
Copy link

@GoooIce GoooIce commented Nov 6, 2025

问题描述

本次修改解决了以下错误:

Error: Generators(Message("failed to run loco db migration. error details: `command [\"cargo\", \"loco-tool\", \"db\", \"migrate\"] exited with code 101`"))

修改内容

loco-gen/src/model.rs 中的数据库迁移命令从 cargo loco-tool 改为 cargo run --,这样可以正确执行应用程序的 CLI 工具。

具体修改:

  • cargo loco-tool db migratecargo run -- db migrate
  • cargo loco-tool db entitiescargo run -- db entities

测试

  • ✅ 运行了 cargo fmt --all 确保代码格式符合规范
  • ✅ 运行了 cargo clippy 检查代码质量
  • ✅ 运行了 cargo test --package loco-gen 验证修复
  • ✅ 所有模型生成测试通过

符合贡献指南

  • ✅ 基于 master 分支
  • ✅ 遵循代码风格(rustfmt)
  • ✅ 通过测试套件

… commands

This change fixes the error when running database migration commands during
model generation. The previous command 'cargo loco-tool db migrate' was failing
with exit code 101. By changing to 'cargo run -- db migrate' and 'cargo run -- db entities',
the commands now correctly execute the application's CLI tool.

Error fixed:
- Error: Generators(Message("failed to run loco db migration. error details: `command [\"cargo\", \"loco-tool\", \"db\", \"migrate\"] exited with code 101`"))

Testing:
- Ran cargo test --package loco-gen to verify the fix
- All model generation tests pass successfully
Replace deprecated Error::internal() call with Error::string() to fix compilation error E0599
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant