关闭生产环境 migrate
This commit is contained in:
parent
b5035bb342
commit
fcfdab0498
4 changed files with 13 additions and 3 deletions
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
|
|
@ -116,7 +116,6 @@ jobs:
|
|||
- name: Debug Query
|
||||
run: |
|
||||
ls -l ./dist/release/
|
||||
coscmd upload -h
|
||||
|
||||
- name: Upload To SV
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -10,9 +10,11 @@ import (
|
|||
"github.com/yaoapp/kun/exception"
|
||||
"github.com/yaoapp/yao/config"
|
||||
"github.com/yaoapp/yao/engine"
|
||||
"github.com/yaoapp/yao/share"
|
||||
)
|
||||
|
||||
var name string
|
||||
var force bool = false
|
||||
var migrateCmd = &cobra.Command{
|
||||
Use: "migrate",
|
||||
Short: L("Update database schema"),
|
||||
|
|
@ -26,6 +28,12 @@ var migrateCmd = &cobra.Command{
|
|||
}()
|
||||
|
||||
Boot()
|
||||
|
||||
if !force && config.Conf.Mode == "production" {
|
||||
fmt.Println(color.WhiteString(L("TRY:")), color.GreenString("%s migrate --force", share.BUILDNAME))
|
||||
exception.New(L("Migrate is not allowed on production mode."), 403).Throw()
|
||||
}
|
||||
|
||||
// 加载数据模型
|
||||
err := engine.Load(config.Conf)
|
||||
if err != nil {
|
||||
|
|
@ -53,4 +61,5 @@ var migrateCmd = &cobra.Command{
|
|||
|
||||
func init() {
|
||||
migrateCmd.PersistentFlags().StringVarP(&name, "name", "n", "", L("Model name"))
|
||||
migrateCmd.PersistentFlags().BoolVarP(&force, "force", "", false, L("Force migrate"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ var langs = map[string]string{
|
|||
"Environment file": "指定环境变量文件",
|
||||
"Help for yao": "显示命令帮助文档",
|
||||
"Show app configure": "显示应用配置信息",
|
||||
"Update database schema": "更新数据库结构",
|
||||
"Update database schema": "更新数据表结构",
|
||||
"Execute process": "运行处理器",
|
||||
"Show version": "显示当前版本号",
|
||||
"Development mode": "使用开发模式启动",
|
||||
|
|
@ -46,6 +46,8 @@ var langs = map[string]string{
|
|||
"Listening": " 监听",
|
||||
"✨LISTENING✨": "✨服务正在运行✨",
|
||||
"SessionPort": "会话服务端口",
|
||||
"Force migrate": "强制更新数据表结构",
|
||||
"Migrate is not allowed on production mode.": "Migrate 不能再生产环境下使用",
|
||||
}
|
||||
|
||||
// L 多语言切换
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ package share
|
|||
// session -> freeport fix bug
|
||||
// 更新制品目录 -> ui/downloads
|
||||
// Arm64 制品 -> arm build test
|
||||
// MacOS 制品 -> debug 13
|
||||
// MacOS 制品 -> debug 14
|
||||
|
||||
// VERSION 版本号
|
||||
const VERSION = "0.9.1"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue