58 Star 193 Fork 74

hidu/mysql-schema-sync

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
alter.go 867 Bytes
一键复制 编辑 原始数据 按行查看 历史
hidu 提交于 2015-11-08 15:56 +08:00 . v0.3 add foreign support
package internal
import (
"fmt"
"strings"
)
type alterType int
const (
alterTypeNo alterType = 0
alterTypeCreate = 1
alterTypeDrop = 2
alterTypeAlter = 3
)
func (at alterType) String() string {
switch at {
case alterTypeNo:
return "not_change"
case alterTypeCreate:
return "create"
case alterTypeDrop:
return "drop"
case alterTypeAlter:
return "alter"
default:
return "unknow"
}
}
// TableAlterData 表的变更情况
type TableAlterData struct {
Table string
Type alterType
SQL string
SchemaDiff *SchemaDiff
}
func (ta *TableAlterData) String() string {
relationTables := ta.SchemaDiff.RelationTables()
fmtStr := `
-- Table : %s
-- Type : %s
-- RealtionTables : %s
-- SQL :
%s
`
return fmt.Sprintf(fmtStr, ta.Table, ta.Type, strings.Join(relationTables, ","), ta.SQL)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/hidu/mysql-schema-sync.git
git@gitee.com:hidu/mysql-schema-sync.git
hidu
mysql-schema-sync
mysql-schema-sync
21680d8e8e24

搜索帮助