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