修改数据表字段类型

This commit is contained in:
bjdgyc 2021-07-20 18:44:13 +08:00
parent 1940fcca87
commit 2ad65039f3
1 changed files with 14 additions and 13 deletions

View File

@ -6,7 +6,7 @@ import (
type Group struct { type Group struct {
Id int `json:"id" xorm:"pk autoincr not null"` Id int `json:"id" xorm:"pk autoincr not null"`
Name string `json:"name" xorm:"varchar(60) not null index(idx_name) unique"` Name string `json:"name" xorm:"varchar(60) not null unique(inx_name)"`
Note string `json:"note" xorm:"varchar(255)"` Note string `json:"note" xorm:"varchar(255)"`
AllowLan bool `json:"allow_lan" xorm:"Bool"` AllowLan bool `json:"allow_lan" xorm:"Bool"`
ClientDns []ValData `json:"client_dns" xorm:"Text"` ClientDns []ValData `json:"client_dns" xorm:"Text"`
@ -15,13 +15,13 @@ type Group struct {
LinkAcl []GroupLinkAcl `json:"link_acl" xorm:"Text"` LinkAcl []GroupLinkAcl `json:"link_acl" xorm:"Text"`
Bandwidth int `json:"bandwidth" xorm:"Int"` // 带宽限制 Bandwidth int `json:"bandwidth" xorm:"Int"` // 带宽限制
Status int8 `json:"status" xorm:"Int"` // 1正常 Status int8 `json:"status" xorm:"Int"` // 1正常
CreatedAt time.Time `json:"created_at" xorm:"DateTime"` CreatedAt time.Time `json:"created_at" xorm:"DateTime created"`
UpdatedAt time.Time `json:"updated_at" xorm:"DateTime"` UpdatedAt time.Time `json:"updated_at" xorm:"DateTime updated"`
} }
type User struct { type User struct {
Id int `json:"id" xorm:"pk autoincr not null"` Id int `json:"id" xorm:"pk autoincr not null"`
Username string `json:"username" xorm:"varchar(60) not null index(idx_username) unique"` Username string `json:"username" xorm:"varchar(60) not null unique(inx_username)"`
Nickname string `json:"nickname" xorm:"varchar(255)"` Nickname string `json:"nickname" xorm:"varchar(255)"`
Email string `json:"email" xorm:"varchar(255)"` Email string `json:"email" xorm:"varchar(255)"`
// Password string `json:"password"` // Password string `json:"password"`
@ -31,24 +31,25 @@ type User struct {
Groups []string `json:"groups" xorm:"Text"` Groups []string `json:"groups" xorm:"Text"`
Status int8 `json:"status" xorm:"Int"` // 1正常 Status int8 `json:"status" xorm:"Int"` // 1正常
SendEmail bool `json:"send_email" xorm:"Bool"` SendEmail bool `json:"send_email" xorm:"Bool"`
CreatedAt time.Time `json:"created_at" xorm:"DateTime"` CreatedAt time.Time `json:"created_at" xorm:"DateTime created"`
UpdatedAt time.Time `json:"updated_at" xorm:"DateTime"` UpdatedAt time.Time `json:"updated_at" xorm:"DateTime updated"`
} }
type IpMap struct { type IpMap struct {
Id int `json:"id" xorm:"pk autoincr not null"` Id int `json:"id" xorm:"pk autoincr not null"`
IpAddr string `json:"ip_addr" xorm:"varchar(32) index(idx_ip_addr)"` IpAddr string `json:"ip_addr" xorm:"varchar(32) not null unique(inx_ip_addr)"`
MacAddr string `json:"mac_addr" xorm:"varchar(32) index(idx_mac_addr)"` MacAddr string `json:"mac_addr" xorm:"varchar(32) not null unique(inx_mac_addr)"`
Username string `json:"username" xorm:"varchar(60)"` Username string `json:"username" xorm:"varchar(60)"`
Keep bool `json:"keep" xorm:"Bool"` // 保留 ip-mac 绑定 Keep bool `json:"keep" xorm:"Bool"` // 保留 ip-mac 绑定
KeepTime time.Time `json:"keep_time" xorm:"DateTime"` KeepTime time.Time `json:"keep_time" xorm:"DateTime"`
Note string `json:"note" xorm:"varchar(255)"` // 备注 Note string `json:"note" xorm:"varchar(255)"` // 备注
LastLogin time.Time `json:"last_login" xorm:"DateTime"` LastLogin time.Time `json:"last_login" xorm:"DateTime updated"`
UpdatedAt time.Time `json:"updated_at" xorm:"DateTime"` UpdatedAt time.Time `json:"updated_at" xorm:"DateTime updated"`
} }
type Setting struct { type Setting struct {
Id int `json:"id" xorm:"pk autoincr not null"` Id int `json:"id" xorm:"pk autoincr not null"`
Name string `json:"name" xorm:"varchar(60) not null unique"` Name string `json:"name" xorm:"varchar(60) not null unique(inx_name)"`
Data string `json:"data" xorm:"Text"` Data string `json:"data" xorm:"Text"`
UpdatedAt time.Time `json:"updated_at" xorm:"DateTime updated"`
} }