mirror of https://github.com/mindoc-org/mindoc.git
添加修改表编码
parent
c36faea699
commit
e282f3442b
|
@ -46,12 +46,24 @@ func RegisterModel() {
|
|||
new(models.Document),
|
||||
new(models.Attachment),
|
||||
new(models.Logger),
|
||||
new(models.CommentVote),
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
func Initialization() {
|
||||
|
||||
o := orm.NewOrm()
|
||||
o.Raw("alter table "+models.NewMember().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
||||
o.Raw("alter table "+models.NewBook().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
||||
o.Raw("alter table "+models.NewRelationship().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
||||
o.Raw("alter table "+models.NewComment().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
||||
o.Raw("alter table " +models.NewOption().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
||||
o.Raw("alter table "+models.NewDocument().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
||||
o.Raw("alter table "+models.NewAttachment().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
||||
o.Raw("alter table "+models.NewLogger().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
||||
o.Raw("alter table "+models.NewCommentVote().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
||||
|
||||
options := []models.Option {
|
||||
{ OptionName: "ENABLED_CAPTCHA", OptionValue: "false", OptionTitle:"是否启用验证码"},
|
||||
{ OptionName: "ENABLED_REGISTER",OptionValue:"false",OptionTitle:"是否启用注册"},
|
||||
|
|
|
@ -32,7 +32,9 @@ func (u *CommentVote) TableUnique() [][]string {
|
|||
[]string{"comment_id", "vote_member_id"},
|
||||
}
|
||||
}
|
||||
|
||||
func NewCommentVote() *CommentVote {
|
||||
return &CommentVote{}
|
||||
}
|
||||
func (m *CommentVote) InsertOrUpdate() (*CommentVote,error) {
|
||||
o := orm.NewOrm()
|
||||
|
||||
|
|
|
@ -37,7 +37,9 @@ func (m *Logger) TableNameWithPrefix() string {
|
|||
return conf.GetDatabasePrefix() + m.TableName()
|
||||
}
|
||||
|
||||
|
||||
func NewLogger() *Logger {
|
||||
return &Logger{}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue