From 2ad65039f3d5cd8d5937a65cedcb8d3e25203ea8 Mon Sep 17 00:00:00 2001 From: bjdgyc Date: Tue, 20 Jul 2021 18:44:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E8=A1=A8?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/dbdata/tables.go | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/server/dbdata/tables.go b/server/dbdata/tables.go index 757fd9e..2e0bf23 100644 --- a/server/dbdata/tables.go +++ b/server/dbdata/tables.go @@ -6,7 +6,7 @@ import ( type Group struct { 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)"` AllowLan bool `json:"allow_lan" xorm:"Bool"` ClientDns []ValData `json:"client_dns" xorm:"Text"` @@ -15,13 +15,13 @@ type Group struct { LinkAcl []GroupLinkAcl `json:"link_acl" xorm:"Text"` Bandwidth int `json:"bandwidth" xorm:"Int"` // 带宽限制 Status int8 `json:"status" xorm:"Int"` // 1正常 - CreatedAt time.Time `json:"created_at" xorm:"DateTime"` - UpdatedAt time.Time `json:"updated_at" xorm:"DateTime"` + CreatedAt time.Time `json:"created_at" xorm:"DateTime created"` + UpdatedAt time.Time `json:"updated_at" xorm:"DateTime updated"` } type User struct { 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)"` Email string `json:"email" xorm:"varchar(255)"` // Password string `json:"password"` @@ -31,24 +31,25 @@ type User struct { Groups []string `json:"groups" xorm:"Text"` Status int8 `json:"status" xorm:"Int"` // 1正常 SendEmail bool `json:"send_email" xorm:"Bool"` - CreatedAt time.Time `json:"created_at" xorm:"DateTime"` - UpdatedAt time.Time `json:"updated_at" xorm:"DateTime"` + CreatedAt time.Time `json:"created_at" xorm:"DateTime created"` + UpdatedAt time.Time `json:"updated_at" xorm:"DateTime updated"` } type IpMap struct { Id int `json:"id" xorm:"pk autoincr not null"` - IpAddr string `json:"ip_addr" xorm:"varchar(32) index(idx_ip_addr)"` - MacAddr string `json:"mac_addr" xorm:"varchar(32) index(idx_mac_addr)"` + IpAddr string `json:"ip_addr" xorm:"varchar(32) not null unique(inx_ip_addr)"` + MacAddr string `json:"mac_addr" xorm:"varchar(32) not null unique(inx_mac_addr)"` Username string `json:"username" xorm:"varchar(60)"` Keep bool `json:"keep" xorm:"Bool"` // 保留 ip-mac 绑定 KeepTime time.Time `json:"keep_time" xorm:"DateTime"` Note string `json:"note" xorm:"varchar(255)"` // 备注 - LastLogin time.Time `json:"last_login" xorm:"DateTime"` - UpdatedAt time.Time `json:"updated_at" xorm:"DateTime"` + LastLogin time.Time `json:"last_login" xorm:"DateTime updated"` + UpdatedAt time.Time `json:"updated_at" xorm:"DateTime updated"` } type Setting struct { - Id int `json:"id" xorm:"pk autoincr not null"` - Name string `json:"name" xorm:"varchar(60) not null unique"` - Data string `json:"data" xorm:"Text"` + Id int `json:"id" xorm:"pk autoincr not null"` + Name string `json:"name" xorm:"varchar(60) not null unique(inx_name)"` + Data string `json:"data" xorm:"Text"` + UpdatedAt time.Time `json:"updated_at" xorm:"DateTime updated"` }