1 Star 2 Fork 3

kristas/booting-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
def.go 1.72 KB
一键复制 编辑 原始数据 按行查看 历史
kristas 提交于 2021-04-19 18:59 . feat: add flyway
package flyway
import (
"encoding/json"
"time"
)
var flywaySchemaHistorySql = "CREATE TABLE IF NOT EXISTS `%s` (`installed_rank` int(11) NOT NULL,`version` varchar(50) DEFAULT NULL,`description` varchar(200) NOT NULL,`type` varchar(20) NOT NULL,`script` varchar(1000) NOT NULL,`checksum` varchar(50) DEFAULT NULL,`installed_by` varchar(100) NOT NULL,`installed_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,`execution_time` int(11) NOT NULL,`success` tinyint(1) NOT NULL,PRIMARY KEY (`installed_rank`),KEY `flyway_schema_history_s_idx` (`success`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;"
type FlywaySchemaHistory struct {
InstalledRank int `gorm:"primaryKey;column:installed_rank;type:int(11);not null" json:"installedRank"`
Version string `gorm:"column:version;type:varchar(50)" json:"version"`
Description string `gorm:"column:description;type:varchar(200);not null" json:"description"`
Type string `gorm:"column:type;type:varchar(20);not null" json:"type"`
Script string `gorm:"column:script;type:varchar(1000);not null" json:"script"`
Checksum string `gorm:"column:checksum;type:varchar(50)" json:"checksum"`
InstalledBy string `gorm:"column:installed_by;type:varchar(100);not null" json:"installedBy"`
InstalledOn *time.Time `gorm:"column:installed_on;type:timestamp;not null;default:CURRENT_TIMESTAMP" json:"installedOn"`
ExecutionTime int `gorm:"column:execution_time;type:int(11);not null" json:"executionTime"`
Success bool `gorm:"index:flyway_schema_history_s_idx;column:success;type:tinyint(1);not null" json:"success"`
}
func (f FlywaySchemaHistory) String() string {
bytes, _ := json.Marshal(f)
return string(bytes)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/kristas/booting-go.git
git@gitee.com:kristas/booting-go.git
kristas
booting-go
booting-go
v1.4.2

搜索帮助