446 Star 3.2K Fork 1.2K

GVP进击的皇虫/BookStack

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
migrations.go 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
TruthHun 提交于 7年前 . 假装第一次提交
package models
import (
"time"
"github.com/TruthHun/BookStack/conf"
"github.com/astaxie/beego/orm"
)
type Migration struct {
MigrationId int `orm:"column(migration_id);pk;auto;unique;" json:"migration_id"`
Name string `orm:"column(name);size(500)" json:"name"`
Statements string `orm:"column(statements);type(text);null" json:"statements"`
Status string `orm:"column(status);default(update)" json:"status"`
CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
Version int64 `orm:"type(bigint);column(version);unique" json:"version"`
}
// TableName 获取对应数据库表名.
func (m *Migration) TableName() string {
return "migrations"
}
// TableEngine 获取数据使用的引擎.
func (m *Migration) TableEngine() string {
return "INNODB"
}
func (m *Migration) TableNameWithPrefix() string {
return conf.GetDatabasePrefix() + m.TableName()
}
func NewMigration() *Migration {
return &Migration{}
}
func (m *Migration) FindFirst() (*Migration, error) {
o := orm.NewOrm()
err := o.QueryTable(m.TableNameWithPrefix()).OrderBy("-migration_id").One(m)
return m, err
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/truthhun/BookStack.git
git@gitee.com:truthhun/BookStack.git
truthhun
BookStack
BookStack
v1.3.1

搜索帮助