feat: 增强命令帮助文档,添加详细说明和示例
This commit is contained in:
@@ -17,6 +17,20 @@ func CommandMigrate(root *cobra.Command) {
|
||||
Use: "migrate [up|up-by-one|up-to|create|down|down-to|fix|redo|reset|status|version]",
|
||||
Aliases: []string{"m"},
|
||||
RunE: commandMigrate,
|
||||
Long: `基于 goose 的数据库迁移工具。
|
||||
|
||||
action:
|
||||
up|up-by-one|up-to|create|down|down-to|fix|redo|reset|status|version
|
||||
|
||||
参数:
|
||||
-c, --config 数据库配置文件(默认 config.toml,读取 [Database])
|
||||
--dir 迁移目录(默认 database/migrations)
|
||||
--table 迁移版本表名(默认 migrations)
|
||||
|
||||
说明:
|
||||
- 执行 create 时会在缺省情况下追加 sql 类型
|
||||
- 使用配置连接数据库,并通过 goose.Run 执行对应 action
|
||||
- 可在代码中通过 goose.SetTableName 自定义版本表名`,
|
||||
}
|
||||
cmd.Flags().StringP("config", "c", "config.toml", "database config file")
|
||||
cmd.Flags().String("dir", "database/migrations", "migrations directory")
|
||||
|
||||
Reference in New Issue
Block a user