🎨用户接口处理完毕

This commit is contained in:
coward 2024-03-07 15:11:29 +08:00
parent 1c0a128855
commit 097505df99
17 changed files with 2079 additions and 59 deletions

View File

@ -1,9 +1,15 @@
package compoment package compoment
import ( import (
"context"
"errors"
"fmt"
"gitee.ltd/lxh/logger/log"
"github.com/golang-jwt/jwt/v5" "github.com/golang-jwt/jwt/v5"
"strings" "strings"
"time" "time"
"wireguard-dashboard/client"
"wireguard-dashboard/constant"
) )
const Secret = "IK8MSs76Pb2VJxleTDadf1Wzu3h9QROLv0XtmnCUErYgBG5wAyjk4cioqFZHNpZG" const Secret = "IK8MSs76Pb2VJxleTDadf1Wzu3h9QROLv0XtmnCUErYgBG5wAyjk4cioqFZHNpZG"
@ -36,6 +42,12 @@ func (j JwtClaims) GenerateToken(userId string) (token string, err error) {
t := jwt.NewWithClaims(jwt.SigningMethodHS256, claims) t := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
token, err = t.SignedString([]byte(Secret)) token, err = t.SignedString([]byte(Secret))
if err != nil {
log.Errorf("生成token失败: %v", err.Error())
return "", errors.New("生成token失败")
}
client.Redis.Set(context.Background(), fmt.Sprintf("%s:%s", constant.Token, userId), token, 7*time.Hour)
return return
} }
@ -52,8 +64,28 @@ func (JwtClaims) ParseToken(token string) (*JwtClaims, error) {
}) })
if claims, ok := t.Claims.(*JwtClaims); ok && t.Valid { if claims, ok := t.Claims.(*JwtClaims); ok && t.Valid {
userToken, err := client.Redis.Get(context.Background(), fmt.Sprintf("%s:%s", constant.Token, claims.ID)).Result()
if err != nil {
log.Errorf("缓存中用户[%s]的token查找失败: %v", claims.ID, err.Error())
return nil, errors.New("token不存在")
}
if userToken != tokenStr {
log.Errorf("token不一致")
return nil, errors.New("token错误")
}
return claims, nil return claims, nil
} else { } else {
return nil, err return nil, err
} }
} }
// Logout
// @description: 退出登陆
// @receiver JwtClaims
// @param userId
// @return err
func (j JwtClaims) Logout(userId string) (err error) {
return client.Redis.Del(context.Background(), fmt.Sprintf("%s:%s", constant.Token, userId)).Err()
}

View File

@ -1,5 +1,6 @@
package constant package constant
const ( const (
Captcha = "captcha" Token = "token" // 登陆token
Captcha = "captcha" // 验证码
) )

29
go.mod
View File

@ -3,6 +3,7 @@ module wireguard-dashboard
go 1.21 go 1.21
require ( require (
gitee.ltd/lxh/logger v1.0.15
github.com/cowardmrx/go_aliyun_oss v1.0.7 github.com/cowardmrx/go_aliyun_oss v1.0.7
github.com/gin-gonic/gin v1.9.1 github.com/gin-gonic/gin v1.9.1
github.com/go-resty/resty/v2 v2.11.0 github.com/go-resty/resty/v2 v2.11.0
@ -10,7 +11,6 @@ require (
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0
github.com/mojocn/base64Captcha v1.3.6 github.com/mojocn/base64Captcha v1.3.6
github.com/redis/go-redis/v9 v9.5.1 github.com/redis/go-redis/v9 v9.5.1
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.21.0 golang.org/x/crypto v0.21.0
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6 golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
@ -22,18 +22,26 @@ require (
require ( require (
github.com/aliyun/aliyun-oss-go-sdk v2.2.5+incompatible // indirect github.com/aliyun/aliyun-oss-go-sdk v2.2.5+incompatible // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.9.1 // indirect github.com/bytedance/sonic v1.9.1 // indirect
github.com/caarlos0/env/v6 v6.10.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/go-sql-driver/mysql v1.7.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.5.9 // indirect github.com/google/go-cmp v0.5.9 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
@ -41,29 +49,48 @@ require (
github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect github.com/jinzhu/now v1.1.5 // indirect
github.com/josharian/native v1.1.0 // indirect github.com/josharian/native v1.1.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/kr/pretty v0.3.1 // indirect github.com/kr/pretty v0.3.1 // indirect
github.com/leodido/go-urn v1.2.4 // indirect github.com/leodido/go-urn v1.2.4 // indirect
github.com/lixh00/loki-client-go v1.0.1 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-sqlite3 v1.14.17 // indirect github.com/mattn/go-sqlite3 v1.14.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect
github.com/mdlayher/genetlink v1.3.2 // indirect github.com/mdlayher/genetlink v1.3.2 // indirect
github.com/mdlayher/netlink v1.7.2 // indirect github.com/mdlayher/netlink v1.7.2 // indirect
github.com/mdlayher/socket v0.4.1 // indirect github.com/mdlayher/socket v0.4.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.13.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/prometheus/prometheus v1.8.2-0.20201028100903-3245b3267b24 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect github.com/ugorji/go/codec v1.2.11 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.10.0 // indirect go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/arch v0.3.0 // indirect golang.org/x/arch v0.3.0 // indirect
golang.org/x/image v0.15.0 // indirect golang.org/x/image v0.15.0 // indirect
golang.org/x/net v0.21.0 // indirect golang.org/x/net v0.21.0 // indirect
golang.org/x/oauth2 v0.1.0 // indirect
golang.org/x/sync v0.1.0 // indirect golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.18.0 // indirect golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect golang.org/x/time v0.3.0 // indirect
golang.zx2c4.com/wireguard v0.0.0-20230325221338-052af4a8072b // indirect golang.zx2c4.com/wireguard v0.0.0-20230325221338-052af4a8072b // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221018160656-63c7b68cfc55 // indirect
google.golang.org/grpc v1.50.1 // indirect
google.golang.org/protobuf v1.30.0 // indirect google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
) )

1112
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,9 @@
package api package api
import ( import (
"gitee.ltd/lxh/logger/log"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"wireguard-dashboard/client"
"wireguard-dashboard/compoment" "wireguard-dashboard/compoment"
"wireguard-dashboard/constant" "wireguard-dashboard/constant"
"wireguard-dashboard/http/param" "wireguard-dashboard/http/param"
@ -66,26 +68,159 @@ func (u user) Login(c *gin.Context) {
}) })
} }
// Logout
// @description: 退出登陆
// @receiver u
// @param c
func (u user) Logout(c *gin.Context) {
data, ok := c.Get("user")
if !ok {
utils.GinResponse(c).FailedWithMsg("你还没有登陆")
return
}
if err := compoment.JWT().Logout(data.(*entity.User).Id); err != nil {
log.Errorf("退出登陆失败: %v", err.Error())
utils.GinResponse(c).FailedWithMsg("退出登陆失败")
return
}
utils.GinResponse(c).OK()
}
// List
// @description: 用户列表
// @receiver u
// @param c
func (u user) List(c *gin.Context) {
var p param.UserList
if err := c.ShouldBind(&p); err != nil {
utils.GinResponse(c).FailedWithErr("参数错误", err)
return
}
data, total, err := repository.User().List(p)
if err != nil {
utils.GinResponse(c).FailedWithMsg("获取失败")
return
}
utils.GinResponse(c).OkWithPage(data, total, p.Current, p.Size)
}
// GetUser // GetUser
// @description: 获取登陆用户信息 // @description: 获取登陆用户信息
// @receiver u // @receiver u
// @param c // @param c
func (u user) GetUser(c *gin.Context) { func (u user) GetUser(c *gin.Context) {
user, ok := c.Get("user") info, ok := c.Get("user")
if !ok { if !ok {
utils.GinResponse(c).FailedWithMsg("获取信息失败") utils.GinResponse(c).FailedWithMsg("获取信息失败")
return return
} }
data := &vo.User{ data := &vo.User{
Id: user.(*entity.User).Id, Id: info.(*entity.User).Id,
Name: user.(*entity.User).Name, Name: info.(*entity.User).Name,
Avatar: user.(*entity.User).Avatar, Avatar: info.(*entity.User).Avatar,
Account: user.(*entity.User).Account, Account: info.(*entity.User).Account,
Email: user.(*entity.User).Email, Email: info.(*entity.User).Email,
IsAdmin: user.(*entity.User).IsAdmin, IsAdmin: info.(*entity.User).IsAdmin,
Status: user.(*entity.User).Status, Status: info.(*entity.User).Status,
CreatedAt: user.(*entity.User).CreatedAt, CreatedAt: info.(*entity.User).CreatedAt,
UpdatedAt: user.(*entity.User).UpdatedAt, UpdatedAt: info.(*entity.User).UpdatedAt,
} }
utils.GinResponse(c).OKWithData(data) utils.GinResponse(c).OKWithData(data)
} }
// Save
// @description: 新增/更改用户信息
// @receiver u
// @param c
func (u user) Save(c *gin.Context) {
var p param.SaveUser
if err := c.ShouldBind(&p); err != nil {
utils.GinResponse(c).FailedWithErr("参数错误", err)
return
}
// 只有新增才会判断
if p.ID == "" {
// 判断用户是否已经存在
var count int64
if err := client.DB.Model(&entity.User{}).Where("account = ?", p.Account).Count(&count).Error; err != nil {
utils.GinResponse(c).FailedWithMsg("查询失败")
return
}
if count > 0 {
utils.GinResponse(c).FailedWithMsg("用户已存在!")
return
}
}
if err := repository.User().Save(&entity.User{
Base: entity.Base{
Id: p.ID,
},
Avatar: p.Avatar,
Name: p.Name,
Account: p.Account,
Email: p.Email,
Password: p.Password,
IsAdmin: p.IsAdmin,
Status: p.Status,
}); err != nil {
utils.GinResponse(c).FailedWithMsg(err.Error())
return
}
utils.GinResponse(c).OK()
}
// ChangePassword
// @description: 更改密码
// @receiver u
// @param c
func (u user) ChangePassword(c *gin.Context) {
var p param.ChangePassword
if err := c.ShouldBind(&p); err != nil {
utils.GinResponse(c).FailedWithErr("参数错误", err)
return
}
user, ok := c.Get("user")
if !ok {
utils.GinResponse(c).AuthorizationFailed()
return
}
if !utils.Password().ComparePassword(user.(*entity.User).Password, p.OriginPassword) {
utils.GinResponse(c).FailedWithMsg("原密码错误")
return
}
// 开始变更密码
if err := repository.User().ChangePassword(p, user.(*entity.User).Id); err != nil {
utils.GinResponse(c).FailedWithMsg("更改密码失败")
return
}
utils.GinResponse(c).OK()
}
// ChangeUserState
// @description: 改变用户状态
// @receiver u
// @param c
func (u user) ChangeUserState(c *gin.Context) {
var p param.ChangeUserState
if err := c.ShouldBind(&p); err != nil {
utils.GinResponse(c).FailedWithErr("参数错误", err)
return
}
if err := repository.User().ChangeUserState(p); err != nil {
utils.GinResponse(c).FailedWithMsg("操作失败")
return
}
utils.GinResponse(c).OK()
}

6
http/param/base.go Normal file
View File

@ -0,0 +1,6 @@
package param
type page struct {
Current int `json:"current" form:"current" binding:"required"`
Size int `json:"size" form:"size" binding:"required"`
}

View File

@ -1,8 +1,46 @@
package param package param
import "wireguard-dashboard/constant"
// Login
// @description: 登陆
type Login struct { type Login struct {
Account string `json:"account" form:"account" binding:"required"` Account string `json:"account" form:"account" binding:"required"` // 账号
Password string `json:"password" form:"password" binding:"required"` Password string `json:"password" form:"password" binding:"required"` // 密码
CaptchaId string `json:"captchaId" form:"captchaId" binding:"required"` CaptchaId string `json:"captchaId" form:"captchaId" binding:"required"` // 验证码id
CaptchaAnswer string `json:"captchaAnswer" form:"captchaAnswer" binding:"required"` CaptchaAnswer string `json:"captchaAnswer" form:"captchaAnswer" binding:"required"` // 验证码
}
// SaveUser
// @description: 新增/编辑用户信息
type SaveUser struct {
ID string `json:"id" form:"id" binding:"omitempty"`
Name string `json:"name" form:"name" binding:"required"` // 用户名
Account string `json:"account" form:"account" binding:"required"` // 账号 唯一
Avatar string `json:"avatar" form:"avatar" binding:"omitempty"` // 头像
Email string `json:"email" form:"email" binding:"omitempty"` // 联系邮箱
Password string `json:"password" form:"password" binding:"omitempty"` // 密码
IsAdmin constant.UserType `json:"isAdmin" form:"isAdmin" binding:"required"` // 是否为管理员 0 - 否 | 1 - 是
Status constant.UserStatus `json:"status" form:"status" binding:"required"` // 用户状态 0 - 禁用 | 1 - 正常
}
// ChangePassword
// @description: 更改密码
type ChangePassword struct {
OriginPassword string `json:"originPassword" form:"originPassword" binding:"required"` // 原密码
NewPassword string `json:"newPassword" form:"newPassword" binding:"required"` // 新密码
ConfirmPassword string `json:"confirmPassword" form:"confirmPassword" binding:"required,eqfield=NewPassword"` // 确认密码
}
// UserList
// @description: 用户列表
type UserList struct {
page
}
// ChangeUserState
// @description: 变更状态
type ChangeUserState struct {
ID string `json:"id" form:"id" binding:"required"` // 用户id
Status string `json:"status" form:"status" binding:"required,oneof=0 1"` // 用户状态
} }

View File

@ -2,6 +2,7 @@ package initialize
import ( import (
"fmt" "fmt"
"gitee.ltd/lxh/logger"
"github.com/cowardmrx/go_aliyun_oss" "github.com/cowardmrx/go_aliyun_oss"
"github.com/go-resty/resty/v2" "github.com/go-resty/resty/v2"
"github.com/redis/go-redis/v9" "github.com/redis/go-redis/v9"
@ -11,10 +12,8 @@ import (
"gorm.io/driver/postgres" "gorm.io/driver/postgres"
"gorm.io/driver/sqlite" "gorm.io/driver/sqlite"
"gorm.io/gorm" "gorm.io/gorm"
"gorm.io/gorm/logger"
"log" "log"
"os" "os"
"time"
"wireguard-dashboard/client" "wireguard-dashboard/client"
"wireguard-dashboard/config" "wireguard-dashboard/config"
) )
@ -22,6 +21,7 @@ import (
// Init // Init
// @description: 初始化 // @description: 初始化
func Init() { func Init() {
initLogger() // 初始化日志
initConfig() // 读取配置文件 initConfig() // 读取配置文件
initWireguard() // 初始化wireguard客户端 initWireguard() // 初始化wireguard客户端
initDatabase() // 初始化数据库 initDatabase() // 初始化数据库
@ -58,17 +58,6 @@ func initWireguard() {
// initDatabase // initDatabase
// @description: 初始化数据库 // @description: 初始化数据库
func initDatabase() { func initDatabase() {
gormLogger := logger.New(
log.New(os.Stdout, "\r\n", log.LstdFlags), // io writer
logger.Config{
SlowThreshold: time.Second, // Slow SQL threshold
LogLevel: logger.Silent, // Log level
IgnoreRecordNotFoundError: true, // Ignore ErrRecordNotFound error for logger
ParameterizedQueries: true, // Don't include params in the SQL log
Colorful: true, // Disable color
},
)
// 不同驱动提供 // 不同驱动提供
var dbDialector gorm.Dialector var dbDialector gorm.Dialector
switch config.Config.Database.Driver { switch config.Config.Database.Driver {
@ -81,7 +70,7 @@ func initDatabase() {
} }
db, err := gorm.Open(dbDialector, &gorm.Config{ db, err := gorm.Open(dbDialector, &gorm.Config{
Logger: gormLogger, Logger: logger.DefaultGormLogger(),
}) })
if err != nil { if err != nil {
@ -126,3 +115,12 @@ func initOSS() {
ossClient := ossConfig.CreateOssConnect() ossClient := ossConfig.CreateOssConnect()
client.OSS = ossClient client.OSS = ossClient
} }
// initLogger
// @description: 初始化日志
func initLogger() {
logger.InitLogger(logger.LogConfig{
Mode: logger.Dev,
FileEnable: true,
})
}

523
logs/runtime-hyxc.log Normal file
View File

@ -0,0 +1,523 @@
[2024-03-07 11:39:22.193] INFO sqlite@v1.5.5/migrator.go:32 [63.3µs] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
[2024-03-07 11:39:22.206] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 11:39:22.206] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
[2024-03-07 11:39:22.206] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 11:39:22.206] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 11:39:22.207] INFO sqlite@v1.5.5/migrator.go:413 [508.6µs] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 11:39:22.207] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:1] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 11:39:22.208] INFO sqlite@v1.5.5/migrator.go:423 [1.0879ms] [rows:1] DROP TABLE `t_user`
[2024-03-07 11:39:22.209] INFO sqlite@v1.5.5/migrator.go:423 [1.1032ms] [rows:1] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 11:39:22.211] INFO sqlite@v1.5.5/migrator.go:79 [71.1µs] [rows:1] PRAGMA foreign_keys
[2024-03-07 11:39:22.211] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 11:39:22.211] INFO sqlite@v1.5.5/migrator.go:413 [0s] [rows:1] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 11:39:22.212] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:1] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 11:39:22.212] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:1] DROP TABLE `t_user`
[2024-03-07 11:39:22.213] INFO sqlite@v1.5.5/migrator.go:423 [1.1628ms] [rows:1] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 11:39:22.214] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
[2024-03-07 11:39:22.215] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 11:39:22.215] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_server` LIMIT 1
[2024-03-07 11:39:22.215] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 11:39:22.217] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
[2024-03-07 11:39:22.218] INFO sqlite@v1.5.5/migrator.go:413 [1.0859ms] [rows:1] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
[2024-03-07 11:39:22.218] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
[2024-03-07 11:39:22.219] INFO sqlite@v1.5.5/migrator.go:423 [1.0538ms] [rows:0] DROP TABLE `t_wg_server`
[2024-03-07 11:39:22.220] INFO sqlite@v1.5.5/migrator.go:423 [1.0028ms] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
[2024-03-07 11:39:22.221] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
[2024-03-07 11:39:22.221] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 11:39:22.222] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
[2024-03-07 11:39:22.222] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 11:39:22.222] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 11:39:22.224] INFO sqlite@v1.5.5/migrator.go:413 [1.0128ms] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 11:39:22.225] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 11:39:22.225] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 11:39:22.226] INFO sqlite@v1.5.5/migrator.go:423 [1.1012ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 11:39:22.228] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 11:39:22.228] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 11:39:22.229] INFO sqlite@v1.5.5/migrator.go:413 [0s] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 11:39:22.230] INFO sqlite@v1.5.5/migrator.go:423 [1.0388ms] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 11:39:22.230] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 11:39:22.230] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 11:39:22.232] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
[2024-03-07 11:39:22.232] INFO script/db_migrate.go:49 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
[2024-03-07 11:39:41.779] INFO repository/user.go:32 [0s] [rows:1] SELECT * FROM `t_user` WHERE account = "Admin" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 11:39:55.538] INFO repository/user.go:21 [112.5µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 11:46:11.901] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
[2024-03-07 11:46:11.915] INFO migrator/migrator.go:73 [1.0033ms] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 11:46:11.915] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
[2024-03-07 11:46:11.915] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 11:46:11.915] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 11:46:11.917] INFO sqlite@v1.5.5/migrator.go:413 [999.9µs] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 11:46:11.917] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:1] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 11:46:11.917] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:1] DROP TABLE `t_user`
[2024-03-07 11:46:11.919] INFO sqlite@v1.5.5/migrator.go:423 [503.3µs] [rows:1] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 11:46:11.921] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 11:46:11.921] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 11:46:11.922] INFO sqlite@v1.5.5/migrator.go:413 [0s] [rows:1] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 11:46:11.922] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:1] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 11:46:11.923] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:1] DROP TABLE `t_user`
[2024-03-07 11:46:11.924] INFO sqlite@v1.5.5/migrator.go:423 [1.0165ms] [rows:1] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 11:46:11.926] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
[2024-03-07 11:46:11.926] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 11:46:11.926] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_server` LIMIT 1
[2024-03-07 11:46:11.927] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 11:46:11.927] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
[2024-03-07 11:46:11.928] INFO sqlite@v1.5.5/migrator.go:413 [1.0461ms] [rows:1] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
[2024-03-07 11:46:11.928] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
[2024-03-07 11:46:11.929] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_server`
[2024-03-07 11:46:11.930] INFO sqlite@v1.5.5/migrator.go:423 [999.9µs] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
[2024-03-07 11:46:11.932] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
[2024-03-07 11:46:11.932] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 11:46:11.933] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
[2024-03-07 11:46:11.933] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 11:46:11.933] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 11:46:11.935] INFO sqlite@v1.5.5/migrator.go:413 [504µs] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 11:46:11.935] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 11:46:11.936] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 11:46:11.937] INFO sqlite@v1.5.5/migrator.go:423 [1.0018ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 11:46:11.939] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 11:46:11.939] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 11:46:11.940] INFO sqlite@v1.5.5/migrator.go:413 [959.7µs] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 11:46:11.940] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 11:46:11.941] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 11:46:11.942] INFO sqlite@v1.5.5/migrator.go:423 [1.0015ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 11:46:11.944] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
[2024-03-07 11:46:11.945] INFO script/db_migrate.go:50 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
[2024-03-07 12:01:13.182] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
[2024-03-07 12:01:13.194] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 12:01:13.195] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
[2024-03-07 12:01:13.195] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 12:01:13.195] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 12:01:13.197] INFO sqlite@v1.5.5/migrator.go:413 [1.159ms] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 12:01:13.197] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:1] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 12:01:13.197] INFO sqlite@v1.5.5/migrator.go:423 [579.4µs] [rows:1] DROP TABLE `t_user`
[2024-03-07 12:01:13.198] INFO sqlite@v1.5.5/migrator.go:423 [1.1276ms] [rows:1] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 12:01:13.201] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 12:01:13.201] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 12:01:13.202] INFO sqlite@v1.5.5/migrator.go:413 [1.0055ms] [rows:1] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 12:01:13.203] INFO sqlite@v1.5.5/migrator.go:423 [504.2µs] [rows:1] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 12:01:13.203] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:1] DROP TABLE `t_user`
[2024-03-07 12:01:13.204] INFO sqlite@v1.5.5/migrator.go:423 [1.0677ms] [rows:1] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 12:01:13.205] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
[2024-03-07 12:01:13.205] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 12:01:13.206] INFO sqlite@v1.5.5/migrator.go:125 [59.7µs] [-] SELECT * FROM `t_wg_server` LIMIT 1
[2024-03-07 12:01:13.206] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 12:01:13.206] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
[2024-03-07 12:01:13.207] INFO sqlite@v1.5.5/migrator.go:413 [573.8µs] [rows:1] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
[2024-03-07 12:01:13.207] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
[2024-03-07 12:01:13.208] INFO sqlite@v1.5.5/migrator.go:423 [504µs] [rows:0] DROP TABLE `t_wg_server`
[2024-03-07 12:01:13.208] INFO sqlite@v1.5.5/migrator.go:423 [521µs] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
[2024-03-07 12:01:13.210] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
[2024-03-07 12:01:13.210] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 12:01:13.210] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
[2024-03-07 12:01:13.211] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 12:01:13.211] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 12:01:13.212] INFO sqlite@v1.5.5/migrator.go:413 [540.9µs] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 12:01:13.212] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 12:01:13.213] INFO sqlite@v1.5.5/migrator.go:423 [616.1µs] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 12:01:13.214] INFO sqlite@v1.5.5/migrator.go:423 [1.1245ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 12:01:13.217] INFO sqlite@v1.5.5/migrator.go:79 [525.6µs] [rows:1] PRAGMA foreign_keys
[2024-03-07 12:01:13.217] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 12:01:13.218] INFO sqlite@v1.5.5/migrator.go:413 [520.1µs] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 12:01:13.218] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 12:01:13.218] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 12:01:13.219] INFO sqlite@v1.5.5/migrator.go:423 [553.6µs] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 12:01:13.222] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
[2024-03-07 12:01:13.222] INFO script/db_migrate.go:50 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
[2024-03-07 12:01:29.181] INFO repository/user.go:47 [504.7µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 12:02:23.977] INFO repository/user.go:47 [211.3µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 12:02:23.977] ERROR repository/user.go:58 record not found -> SELECT * FROM `t_user` WHERE account = "123123123" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:06:09.134] INFO repository/user.go:47 [438µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:06:09.134] ERROR repository/user.go:58 record not found -> SELECT * FROM `t_user` WHERE account = "123123123" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:06:32.385] INFO repository/user.go:47 [911.4µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:06:32.386] ERROR repository/user.go:58 record not found -> SELECT * FROM `t_user` WHERE account = "123123123" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:08:38.344] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
[2024-03-07 14:08:38.356] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:08:38.357] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
[2024-03-07 14:08:38.357] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:08:38.357] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:08:38.358] INFO sqlite@v1.5.5/migrator.go:413 [566.5µs] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:08:38.358] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:1] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:08:38.359] INFO sqlite@v1.5.5/migrator.go:423 [554µs] [rows:1] DROP TABLE `t_user`
[2024-03-07 14:08:38.360] INFO sqlite@v1.5.5/migrator.go:423 [1.1329ms] [rows:1] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:08:38.361] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:08:38.361] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:08:38.363] INFO sqlite@v1.5.5/migrator.go:413 [586.4µs] [rows:1] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:08:38.363] INFO sqlite@v1.5.5/migrator.go:423 [559.9µs] [rows:1] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:08:38.363] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:1] DROP TABLE `t_user`
[2024-03-07 14:08:38.365] INFO sqlite@v1.5.5/migrator.go:423 [1.1457ms] [rows:1] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:08:38.367] INFO sqlite@v1.5.5/migrator.go:32 [56.5µs] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
[2024-03-07 14:08:38.367] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:08:38.367] INFO sqlite@v1.5.5/migrator.go:125 [75.3µs] [-] SELECT * FROM `t_wg_server` LIMIT 1
[2024-03-07 14:08:38.367] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:08:38.367] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
[2024-03-07 14:08:38.369] INFO sqlite@v1.5.5/migrator.go:413 [1.1745ms] [rows:1] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
[2024-03-07 14:08:38.369] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
[2024-03-07 14:08:38.370] INFO sqlite@v1.5.5/migrator.go:423 [582.9µs] [rows:0] DROP TABLE `t_wg_server`
[2024-03-07 14:08:38.371] INFO sqlite@v1.5.5/migrator.go:423 [1.092ms] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
[2024-03-07 14:08:38.372] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
[2024-03-07 14:08:38.372] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:08:38.373] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
[2024-03-07 14:08:38.373] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:08:38.373] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:08:38.375] INFO sqlite@v1.5.5/migrator.go:413 [950µs] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:08:38.375] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:08:38.375] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:08:38.376] INFO sqlite@v1.5.5/migrator.go:423 [1.6338ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:08:38.378] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:08:38.378] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:08:38.379] INFO sqlite@v1.5.5/migrator.go:413 [0s] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:08:38.380] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:08:38.380] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:08:38.381] INFO sqlite@v1.5.5/migrator.go:423 [1.0888ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:08:38.383] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
[2024-03-07 14:08:38.383] INFO script/db_migrate.go:50 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
[2024-03-07 14:08:40.261] INFO repository/user.go:47 [778.7µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:08:40.261] INFO api/user.go:126 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE account = "123123123"
[2024-03-07 14:08:41.171] INFO repository/user.go:37 [3.4901ms] [rows:1] INSERT INTO `t_user` (`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) VALUES ("2ac392865c644d1daaeb6ddd6b516e97","2024-03-07 14:08:41","2024-03-07 14:08:41","http://wireguard-dashboard.oss-cn-chengdu.aliyuncs.com/wg/25fd738f-007d-4415-aac6-cfa008f84160.png","张三","123123123","","hahahaha",1,1)
[2024-03-07 14:08:51.686] INFO repository/user.go:47 [950.7µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:08:51.687] INFO api/user.go:126 [506.3µs] [rows:1] SELECT count(*) FROM `t_user` WHERE account = "123123123"
[2024-03-07 14:09:56.542] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
[2024-03-07 14:09:56.555] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:09:56.555] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
[2024-03-07 14:09:56.556] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:09:56.556] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:09:56.557] INFO sqlite@v1.5.5/migrator.go:413 [612µs] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:09:56.558] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:09:56.558] INFO sqlite@v1.5.5/migrator.go:423 [530.4µs] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:09:56.559] INFO sqlite@v1.5.5/migrator.go:423 [1.2126ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:09:56.561] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:09:56.561] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:09:56.562] INFO sqlite@v1.5.5/migrator.go:413 [576.8µs] [rows:2] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:09:56.562] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:09:56.563] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:09:56.564] INFO sqlite@v1.5.5/migrator.go:423 [1.0557ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:09:56.567] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
[2024-03-07 14:09:56.567] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:09:56.567] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_server` LIMIT 1
[2024-03-07 14:09:56.567] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:09:56.567] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
[2024-03-07 14:09:56.568] INFO sqlite@v1.5.5/migrator.go:413 [0s] [rows:2] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
[2024-03-07 14:09:56.568] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
[2024-03-07 14:09:56.569] INFO sqlite@v1.5.5/migrator.go:423 [56µs] [rows:0] DROP TABLE `t_wg_server`
[2024-03-07 14:09:56.571] INFO sqlite@v1.5.5/migrator.go:423 [2.2125ms] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
[2024-03-07 14:09:56.573] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
[2024-03-07 14:09:56.573] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:09:56.574] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
[2024-03-07 14:09:56.574] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:09:56.574] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:09:56.575] INFO sqlite@v1.5.5/migrator.go:413 [1.177ms] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:09:56.575] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:09:56.576] INFO sqlite@v1.5.5/migrator.go:423 [1.0873ms] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:09:56.577] INFO sqlite@v1.5.5/migrator.go:423 [1.091ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:09:56.579] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:09:56.579] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:09:56.580] INFO sqlite@v1.5.5/migrator.go:413 [1.1019ms] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:09:56.580] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:09:56.581] INFO sqlite@v1.5.5/migrator.go:423 [1.0567ms] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:09:56.582] INFO sqlite@v1.5.5/migrator.go:423 [1.0689ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:09:56.584] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
[2024-03-07 14:09:56.585] INFO script/db_migrate.go:50 [174.4µs] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
[2024-03-07 14:11:37.702] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
[2024-03-07 14:11:37.714] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:11:37.715] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
[2024-03-07 14:11:37.715] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:11:37.715] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:11:37.717] INFO sqlite@v1.5.5/migrator.go:413 [1.1811ms] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:11:37.717] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:11:37.717] INFO sqlite@v1.5.5/migrator.go:423 [564.7µs] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:11:37.719] INFO sqlite@v1.5.5/migrator.go:423 [1.1244ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:11:37.720] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:11:37.720] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:11:37.721] INFO sqlite@v1.5.5/migrator.go:413 [1.0261ms] [rows:2] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:11:37.721] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:11:37.721] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:11:37.723] INFO sqlite@v1.5.5/migrator.go:423 [1.5032ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:11:37.726] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
[2024-03-07 14:11:37.726] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:11:37.726] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_server` LIMIT 1
[2024-03-07 14:11:37.726] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:11:37.727] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
[2024-03-07 14:11:37.728] INFO sqlite@v1.5.5/migrator.go:413 [1.0401ms] [rows:2] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
[2024-03-07 14:11:37.728] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
[2024-03-07 14:11:37.728] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_server`
[2024-03-07 14:11:37.729] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
[2024-03-07 14:11:37.731] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
[2024-03-07 14:11:37.731] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:11:37.732] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
[2024-03-07 14:11:37.732] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:11:37.732] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:11:37.733] INFO sqlite@v1.5.5/migrator.go:413 [0s] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:11:37.733] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:11:37.734] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:11:37.735] INFO sqlite@v1.5.5/migrator.go:423 [1.5008ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:11:37.737] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:11:37.737] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:11:37.739] INFO sqlite@v1.5.5/migrator.go:413 [1.0917ms] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:11:37.739] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:11:37.740] INFO sqlite@v1.5.5/migrator.go:423 [1.0014ms] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:11:37.740] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:11:37.742] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
[2024-03-07 14:11:37.742] INFO script/db_migrate.go:50 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
[2024-03-07 14:11:44.300] INFO repository/user.go:55 [818.9µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:11:53.083] INFO repository/user.go:55 [502.1µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:11:59.339] INFO repository/user.go:55 [800µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:12:03.207] INFO repository/user.go:55 [146.1µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:12:15.084] INFO repository/user.go:55 [868.9µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:12:39.296] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
[2024-03-07 14:12:39.307] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:12:39.308] INFO sqlite@v1.5.5/migrator.go:125 [70.6µs] [-] SELECT * FROM `t_user` LIMIT 1
[2024-03-07 14:12:39.308] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:12:39.308] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:12:39.310] INFO sqlite@v1.5.5/migrator.go:413 [1.1822ms] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:12:39.310] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:12:39.310] INFO sqlite@v1.5.5/migrator.go:423 [68.5µs] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:12:39.311] INFO sqlite@v1.5.5/migrator.go:423 [1.1698ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:12:39.313] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:12:39.313] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:12:39.314] INFO sqlite@v1.5.5/migrator.go:413 [565.1µs] [rows:2] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:12:39.314] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:12:39.315] INFO sqlite@v1.5.5/migrator.go:423 [962µs] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:12:39.316] INFO sqlite@v1.5.5/migrator.go:423 [583.4µs] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:12:39.318] INFO sqlite@v1.5.5/migrator.go:32 [69.9µs] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
[2024-03-07 14:12:39.318] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:12:39.318] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_server` LIMIT 1
[2024-03-07 14:12:39.318] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:12:39.318] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
[2024-03-07 14:12:39.320] INFO sqlite@v1.5.5/migrator.go:413 [651.3µs] [rows:2] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
[2024-03-07 14:12:39.320] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
[2024-03-07 14:12:39.320] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_server`
[2024-03-07 14:12:39.322] INFO sqlite@v1.5.5/migrator.go:423 [1.1351ms] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
[2024-03-07 14:12:39.323] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
[2024-03-07 14:12:39.324] INFO migrator/migrator.go:73 [1.0967ms] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:12:39.324] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
[2024-03-07 14:12:39.324] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:12:39.324] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:12:39.326] INFO sqlite@v1.5.5/migrator.go:413 [1.0529ms] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:12:39.326] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:12:39.326] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:12:39.327] INFO sqlite@v1.5.5/migrator.go:423 [1.0869ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:12:39.329] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:12:39.329] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:12:39.330] INFO sqlite@v1.5.5/migrator.go:413 [1.1357ms] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:12:39.330] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:12:39.330] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:12:39.332] INFO sqlite@v1.5.5/migrator.go:423 [65µs] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:12:39.334] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
[2024-03-07 14:12:39.334] INFO script/db_migrate.go:50 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
[2024-03-07 14:12:40.382] INFO repository/user.go:55 [1.0007ms] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:12:41.405] INFO api/user.go:126 [209.4µs] [rows:1] SELECT count(*) FROM `t_user` WHERE account = "123123123"
[2024-03-07 14:14:42.943] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
[2024-03-07 14:14:42.956] INFO migrator/migrator.go:73 [599µs] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:14:42.956] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
[2024-03-07 14:14:42.957] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:14:42.957] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:14:42.958] INFO sqlite@v1.5.5/migrator.go:413 [1.0837ms] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:14:42.958] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:14:42.959] INFO sqlite@v1.5.5/migrator.go:423 [531.9µs] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:14:42.960] INFO sqlite@v1.5.5/migrator.go:423 [1.1284ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:14:42.961] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:14:42.961] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:14:42.962] INFO sqlite@v1.5.5/migrator.go:413 [520.2µs] [rows:2] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:14:42.962] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:14:42.963] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:14:42.964] INFO sqlite@v1.5.5/migrator.go:423 [1.0572ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:14:42.966] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
[2024-03-07 14:14:42.966] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:14:42.966] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_server` LIMIT 1
[2024-03-07 14:14:42.966] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:14:42.966] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
[2024-03-07 14:14:42.967] INFO sqlite@v1.5.5/migrator.go:413 [529.4µs] [rows:2] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
[2024-03-07 14:14:42.967] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
[2024-03-07 14:14:42.968] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_server`
[2024-03-07 14:14:42.969] INFO sqlite@v1.5.5/migrator.go:423 [1.1041ms] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
[2024-03-07 14:14:42.971] INFO sqlite@v1.5.5/migrator.go:32 [520.9µs] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
[2024-03-07 14:14:42.971] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:14:42.971] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
[2024-03-07 14:14:42.971] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:14:42.971] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:14:42.973] INFO sqlite@v1.5.5/migrator.go:413 [1.0581ms] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:14:42.973] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:14:42.974] INFO sqlite@v1.5.5/migrator.go:423 [550µs] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:14:42.974] INFO sqlite@v1.5.5/migrator.go:423 [511.8µs] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:14:42.976] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:14:42.976] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:14:42.977] INFO sqlite@v1.5.5/migrator.go:413 [538.9µs] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:14:42.977] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:14:42.978] INFO sqlite@v1.5.5/migrator.go:423 [518.8µs] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:14:42.978] INFO sqlite@v1.5.5/migrator.go:423 [521.7µs] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:14:42.980] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
[2024-03-07 14:14:42.981] INFO script/db_migrate.go:50 [504.6µs] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
[2024-03-07 14:14:44.106] INFO repository/user.go:55 [91.3µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:15:48.092] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
[2024-03-07 14:15:48.104] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:15:48.104] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
[2024-03-07 14:15:48.104] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:15:48.105] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:15:48.106] INFO sqlite@v1.5.5/migrator.go:413 [636.6µs] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:15:48.106] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:15:48.107] INFO sqlite@v1.5.5/migrator.go:423 [56.7µs] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:15:48.108] INFO sqlite@v1.5.5/migrator.go:423 [666.7µs] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:15:48.110] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:15:48.110] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:15:48.111] INFO sqlite@v1.5.5/migrator.go:413 [660µs] [rows:2] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:15:48.111] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:15:48.112] INFO sqlite@v1.5.5/migrator.go:423 [563.1µs] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:15:48.113] INFO sqlite@v1.5.5/migrator.go:423 [1.0908ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:15:48.114] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
[2024-03-07 14:15:48.115] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:15:48.115] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_server` LIMIT 1
[2024-03-07 14:15:48.115] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:15:48.115] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
[2024-03-07 14:15:48.116] INFO sqlite@v1.5.5/migrator.go:413 [631.1µs] [rows:2] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
[2024-03-07 14:15:48.117] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
[2024-03-07 14:15:48.117] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_server`
[2024-03-07 14:15:48.118] INFO sqlite@v1.5.5/migrator.go:423 [1.2075ms] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
[2024-03-07 14:15:48.119] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
[2024-03-07 14:15:48.120] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:15:48.120] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
[2024-03-07 14:15:48.121] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:15:48.121] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:15:48.122] INFO sqlite@v1.5.5/migrator.go:413 [613.3µs] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:15:48.122] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:15:48.122] INFO sqlite@v1.5.5/migrator.go:423 [564µs] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:15:48.123] INFO sqlite@v1.5.5/migrator.go:423 [1.112ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:15:48.125] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:15:48.125] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:15:48.126] INFO sqlite@v1.5.5/migrator.go:413 [569.1µs] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:15:48.126] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:15:48.126] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:15:48.127] INFO sqlite@v1.5.5/migrator.go:423 [634.5µs] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:15:48.128] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
[2024-03-07 14:15:48.128] INFO script/db_migrate.go:50 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
[2024-03-07 14:15:49.260] INFO repository/user.go:55 [765.6µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:15:50.647] ERROR repository/user.go:31 no such column: isAdmin -> UPDATE `t_user` SET `avatar`="",`email`="",`isAdmin`=1,`name`="张三1",`status`=1,`updated_at`="2024-03-07 14:15:50.646" WHERE id = "2ac392865c644d1daaeb6ddd6b516e97"
[2024-03-07 14:16:02.228] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
[2024-03-07 14:16:02.242] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:16:02.242] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
[2024-03-07 14:16:02.242] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:16:02.243] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:16:02.245] INFO sqlite@v1.5.5/migrator.go:413 [1.0051ms] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:16:02.245] INFO sqlite@v1.5.5/migrator.go:423 [503.6µs] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:16:02.245] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:16:02.246] INFO sqlite@v1.5.5/migrator.go:423 [1.004ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:16:02.248] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:16:02.248] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:16:02.249] INFO sqlite@v1.5.5/migrator.go:413 [0s] [rows:2] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:16:02.249] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:16:02.250] INFO sqlite@v1.5.5/migrator.go:423 [1.4226ms] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:16:02.252] INFO sqlite@v1.5.5/migrator.go:423 [1.5116ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:16:02.253] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
[2024-03-07 14:16:02.253] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:16:02.254] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_server` LIMIT 1
[2024-03-07 14:16:02.254] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:16:02.254] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
[2024-03-07 14:16:02.256] INFO sqlite@v1.5.5/migrator.go:413 [1.0073ms] [rows:2] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
[2024-03-07 14:16:02.256] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
[2024-03-07 14:16:02.257] INFO sqlite@v1.5.5/migrator.go:423 [999.4µs] [rows:0] DROP TABLE `t_wg_server`
[2024-03-07 14:16:02.258] INFO sqlite@v1.5.5/migrator.go:423 [998.4µs] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
[2024-03-07 14:16:02.260] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
[2024-03-07 14:16:02.260] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:16:02.260] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
[2024-03-07 14:16:02.260] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:16:02.261] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:16:02.262] INFO sqlite@v1.5.5/migrator.go:413 [1.0017ms] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:16:02.262] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:16:02.263] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:16:02.264] INFO sqlite@v1.5.5/migrator.go:423 [1.0031ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:16:02.266] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:16:02.266] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:16:02.268] INFO sqlite@v1.5.5/migrator.go:413 [1.0001ms] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:16:02.268] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:16:02.268] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:16:02.269] INFO sqlite@v1.5.5/migrator.go:423 [1.0005ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:16:02.271] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
[2024-03-07 14:16:02.272] INFO script/db_migrate.go:50 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
[2024-03-07 14:16:03.225] INFO repository/user.go:55 [1.5847ms] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:16:04.658] INFO repository/user.go:31 [2.6176ms] [rows:1] UPDATE `t_user` SET `avatar`="",`email`="",`is_admin`=1,`name`="张三1",`status`=1,`updated_at`="2024-03-07 14:16:04.656" WHERE id = "2ac392865c644d1daaeb6ddd6b516e97"
[2024-03-07 14:45:21.473] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
[2024-03-07 14:45:21.489] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:45:21.489] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
[2024-03-07 14:45:21.489] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:45:21.490] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:45:21.491] INFO sqlite@v1.5.5/migrator.go:413 [1.5644ms] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:45:21.492] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:45:21.493] INFO sqlite@v1.5.5/migrator.go:423 [595.3µs] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:45:21.494] INFO sqlite@v1.5.5/migrator.go:423 [1.042ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:45:21.498] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:45:21.498] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:45:21.500] INFO sqlite@v1.5.5/migrator.go:413 [1.0362ms] [rows:2] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:45:21.500] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:45:21.501] INFO sqlite@v1.5.5/migrator.go:423 [525.4µs] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:45:21.503] INFO sqlite@v1.5.5/migrator.go:423 [1.6078ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:45:21.507] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
[2024-03-07 14:45:21.507] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:45:21.507] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_server` LIMIT 1
[2024-03-07 14:45:21.507] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:45:21.509] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
[2024-03-07 14:45:21.509] INFO sqlite@v1.5.5/migrator.go:413 [0s] [rows:2] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
[2024-03-07 14:45:21.510] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
[2024-03-07 14:45:21.510] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_server`
[2024-03-07 14:45:21.511] INFO sqlite@v1.5.5/migrator.go:423 [961µs] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
[2024-03-07 14:45:21.513] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
[2024-03-07 14:45:21.513] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:45:21.514] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
[2024-03-07 14:45:21.514] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:45:21.514] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:45:21.515] INFO sqlite@v1.5.5/migrator.go:413 [0s] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:45:21.516] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:45:21.517] INFO sqlite@v1.5.5/migrator.go:423 [1.0111ms] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:45:21.518] INFO sqlite@v1.5.5/migrator.go:423 [1.0017ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:45:21.520] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:45:21.520] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:45:21.521] INFO sqlite@v1.5.5/migrator.go:413 [560.2µs] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:45:21.522] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:45:21.523] INFO sqlite@v1.5.5/migrator.go:423 [579.2µs] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:45:21.524] INFO sqlite@v1.5.5/migrator.go:423 [1.1393ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:45:21.525] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
[2024-03-07 14:45:21.525] INFO script/db_migrate.go:50 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
[2024-03-07 14:45:30.353] INFO repository/user.go:68 [688.9µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:45:58.264] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_user"
[2024-03-07 14:45:58.278] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_user" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:45:58.278] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_user` LIMIT 1
[2024-03-07 14:45:58.278] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:45:58.278] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:45:58.280] INFO sqlite@v1.5.5/migrator.go:413 [1.0005ms] [rows:0] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:45:58.280] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:45:58.280] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:45:58.282] INFO sqlite@v1.5.5/migrator.go:423 [1.0005ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:45:58.284] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:45:58.284] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_user" AND name = "t_user"
[2024-03-07 14:45:58.284] INFO sqlite@v1.5.5/migrator.go:413 [0s] [rows:2] CREATE TABLE `t_user__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`avatar` varchar(255) NOT NULL,`name` varchar(50) NOT NULL,`account` varchar(50) NOT NULL,`email` varchar(255),`password` varchar(255) NOT NULL,`is_admin` int(1) NOT NULL,`status` int(1) NOT NULL,PRIMARY KEY (`id`))
[2024-03-07 14:45:58.286] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] INSERT INTO `t_user__temp`(`id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status`) SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`email`,`password`,`is_admin`,`status` FROM `t_user`
[2024-03-07 14:45:58.286] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:2] DROP TABLE `t_user`
[2024-03-07 14:45:58.287] INFO sqlite@v1.5.5/migrator.go:423 [1.0048ms] [rows:2] ALTER TABLE `t_user__temp` RENAME TO `t_user`
[2024-03-07 14:45:58.289] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_server"
[2024-03-07 14:45:58.289] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_server" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:45:58.289] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_server` LIMIT 1
[2024-03-07 14:45:58.289] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:45:58.290] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_server" AND name = "t_wg_server"
[2024-03-07 14:45:58.291] INFO sqlite@v1.5.5/migrator.go:413 [1.0009ms] [rows:2] CREATE TABLE `t_wg_server__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`ip_scope` varchar(30) NOT NULL,`listen_port` int(10) NOT NULL,`private_key` text NOT NULL,`public_key` text NOT NULL,`post_up_script` text,`pre_down_script` text,`post_down_script` text,PRIMARY KEY (`id`))
[2024-03-07 14:45:58.291] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_server__temp`(`id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script`) SELECT `id`,`created_at`,`updated_at`,`ip_scope`,`listen_port`,`private_key`,`public_key`,`post_up_script`,`pre_down_script`,`post_down_script` FROM `t_wg_server`
[2024-03-07 14:45:58.291] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_server`
[2024-03-07 14:45:58.292] INFO sqlite@v1.5.5/migrator.go:423 [1ms] [rows:0] ALTER TABLE `t_wg_server__temp` RENAME TO `t_wg_server`
[2024-03-07 14:45:58.294] INFO sqlite@v1.5.5/migrator.go:32 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="t_wg_client"
[2024-03-07 14:45:58.294] INFO migrator/migrator.go:73 [0s] [rows:1] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "t_wg_client" AND sql IS NOT NULL order by type = "table" desc
[2024-03-07 14:45:58.294] INFO sqlite@v1.5.5/migrator.go:125 [0s] [-] SELECT * FROM `t_wg_client` LIMIT 1
[2024-03-07 14:45:58.295] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:45:58.295] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:45:58.295] INFO sqlite@v1.5.5/migrator.go:413 [0s] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:45:58.296] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:45:58.296] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:45:58.297] INFO sqlite@v1.5.5/migrator.go:423 [1.005ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:45:58.299] INFO sqlite@v1.5.5/migrator.go:79 [0s] [rows:1] PRAGMA foreign_keys
[2024-03-07 14:45:58.299] INFO sqlite@v1.5.5/migrator.go:368 [0s] [-] SELECT sql FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND name = "t_wg_client"
[2024-03-07 14:45:58.300] INFO sqlite@v1.5.5/migrator.go:413 [1.0089ms] [rows:0] CREATE TABLE `t_wg_client__temp` (`id` varchar(36) NOT NULL,`created_at` datetime,`updated_at` datetime,`server_id` varchar(36) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100),`subnet_range` varchar(255),`ip_allocation` varchar(30) NOT NULL,`allowed_ips` varchar(30) NOT NULL,`extra_allowed_ips` varchar(30),`endpoint` varchar(255),`use_server_dns` int(1),`enable_after_creation` int(1),`keys` text,`user_id` char(36) NOT NULL,PRIMARY KEY (`id`),CONSTRAINT `fk_t_wg_server_clients` FOREIGN KEY (`server_id`) REFERENCES `t_wg_server`(`id`))
[2024-03-07 14:45:58.300] INFO sqlite@v1.5.5/migrator.go:423 [0s] [rows:0] INSERT INTO `t_wg_client__temp`(`id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id`) SELECT `id`,`created_at`,`updated_at`,`server_id`,`name`,`email`,`subnet_range`,`ip_allocation`,`allowed_ips`,`extra_allowed_ips`,`endpoint`,`use_server_dns`,`enable_after_creation`,`keys`,`user_id` FROM `t_wg_client`
[2024-03-07 14:45:58.301] INFO sqlite@v1.5.5/migrator.go:423 [988.6µs] [rows:0] DROP TABLE `t_wg_client`
[2024-03-07 14:45:58.302] INFO sqlite@v1.5.5/migrator.go:423 [1.0107ms] [rows:0] ALTER TABLE `t_wg_client__temp` RENAME TO `t_wg_client`
[2024-03-07 14:45:58.303] INFO sqlite@v1.5.5/migrator.go:219 [0s] [-] SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "t_wg_client" AND (sql LIKE "%CONSTRAINT ""fk_t_wg_server_clients"" %" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %" OR sql LIKE "%CONSTRAINT `fk_t_wg_server_clients`%" OR sql LIKE "%CONSTRAINT [fk_t_wg_server_clients]%" OR sql LIKE "%CONSTRAINT fk_t_wg_server_clients %")
[2024-03-07 14:45:58.304] INFO script/db_migrate.go:50 [0s] [rows:1] SELECT count(*) FROM `t_user` WHERE is_admin = 1
[2024-03-07 14:45:59.588] INFO repository/user.go:68 [224.6µs] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:46:13.620] INFO repository/user.go:68 [0s] [rows:1] SELECT * FROM `t_user` WHERE id = "21b09f1bbff54512bed815f991fae7f8" ORDER BY `t_user`.`id` LIMIT 1
[2024-03-07 14:46:13.621] INFO repository/user.go:93 [1.504ms] [rows:2] SELECT `id`,`created_at`,`updated_at`,`avatar`,`name`,`account`,`is_admin`,`status` FROM `t_user` ORDER BY created_at DESC LIMIT 10
[2024-03-07 14:46:13.622] INFO repository/user.go:93 [519.9µs] [rows:1] SELECT count(*) FROM `t_user`

View File

@ -2,8 +2,7 @@ package main
import ( import (
"fmt" "fmt"
"go.uber.org/zap" "gitee.ltd/lxh/logger/log"
"log"
"net/http" "net/http"
"wireguard-dashboard/config" "wireguard-dashboard/config"
"wireguard-dashboard/initialize" "wireguard-dashboard/initialize"
@ -14,7 +13,7 @@ import (
func init() { func init() {
initialize.Init() // 初始化 initialize.Init() // 初始化
if err := script.NewScript().Do(); err != nil { if err := script.NewScript().Do(); err != nil {
zap.S().Errorf("执行脚本错误: %v", err.Error()) log.Errorf("执行脚本失败: %v", err.Error())
} }
} }

View File

@ -12,7 +12,7 @@ type User struct {
Email string `json:"email" gorm:"type:varchar(255);default null;comment:'联系邮箱'"` Email string `json:"email" gorm:"type:varchar(255);default null;comment:'联系邮箱'"`
Password string `json:"password" gorm:"type:varchar(255);not null;comment:'密码'"` Password string `json:"password" gorm:"type:varchar(255);not null;comment:'密码'"`
IsAdmin constant.UserType `json:"isAdmin" gorm:"type:int(1);not null;comment:'是否为管理员'"` IsAdmin constant.UserType `json:"isAdmin" gorm:"type:int(1);not null;comment:'是否为管理员'"`
Status constant.UserStatus `json:"status" gorm:"type:int(1);not null;comment:'用户状态0 - 禁用 | 1 - 正常)'"` Status constant.UserStatus `json:"status" gorm:"type:tinyint(1);not null;comment:'用户状态0 - 禁用 | 1 - 正常)'"`
} }
func (*User) TableName() string { func (*User) TableName() string {

View File

@ -2,7 +2,10 @@ package repository
import ( import (
"wireguard-dashboard/client" "wireguard-dashboard/client"
"wireguard-dashboard/http/param"
"wireguard-dashboard/model/entity" "wireguard-dashboard/model/entity"
"wireguard-dashboard/model/vo"
"wireguard-dashboard/utils"
) )
type user struct{} type user struct{}
@ -11,6 +14,21 @@ func User() user {
return user{} return user{}
} }
// List
// @description: 用户列表
// @receiver r
// @param p
// @return data
// @return total
// @return err
func (r user) List(p param.UserList) (data []vo.User, total int64, err error) {
err = client.DB.Model(&entity.User{}).Scopes(utils.Page(p.Current, p.Size)).
Select("id", "created_at", "updated_at", "avatar", "name", "account", "is_admin", "status").Order("created_at DESC").
Find(&data).Offset(-1).Limit(-1).Count(&total).Error
return
}
// GetUserById // GetUserById
// @description: 根据id获取用户信息 // @description: 根据id获取用户信息
// @receiver r // @receiver r
@ -32,3 +50,56 @@ func (r user) GetUserByAccount(account string) (data *entity.User, err error) {
err = client.DB.Where("account = ?", account).First(&data).Error err = client.DB.Where("account = ?", account).First(&data).Error
return return
} }
// Save
// @description: 创建/更新用户
// @receiver r
// @param ent
// @return err
func (r user) Save(ent *entity.User) (err error) {
// 更新
if ent.Id != "" {
updates := map[string]any{
"name": ent.Name,
"avatar": ent.Avatar,
"email": ent.Email,
"is_admin": ent.IsAdmin,
"status": ent.Status,
}
return client.DB.Model(&entity.User{}).Where("id = ?", ent.Id).Updates(&updates).Error
}
defaultPassword := utils.Password().GenerateHashPassword("admin123")
if ent.Password == "" { // 没有密码给一个默认密码
ent.Password = defaultPassword
}
// 没有头像就生成一个头像
if ent.Avatar == "" {
ent.Avatar, _ = utils.Avatar().GenerateAvatar()
}
// 创建
return client.DB.Create(&ent).Error
}
// ChangePassword
// @description: 变更密码
// @receiver r
// @param p
// @param userId
// @return err
func (r user) ChangePassword(p param.ChangePassword, userId string) (err error) {
password := utils.Password().GenerateHashPassword(p.NewPassword)
return client.DB.Model(&entity.User{}).Where("id = ?", userId).Update("password", password).Error
}
// ChangeUserState
// @description: 变更用户状态
// @receiver r
// @param p
// @return err
func (r user) ChangeUserState(p param.ChangeUserState) (err error) {
return client.DB.Model(&entity.User{}).Where("id = ?", p.ID).Update("status", p.Status).Error
}

View File

@ -14,8 +14,13 @@ func UserApi(r *gin.Engine) {
} }
// 用户登陆后相关的API // 用户登陆后相关的API
userApi := r.Group("user") userApi := r.Group("user", middleware.Authorization())
{ {
userApi.GET("", middleware.Authorization(), api.UserApi().GetUser) // 获取登陆用户信息 userApi.DELETE("logout", api.UserApi().Logout) // 用户退出登陆
userApi.GET("", api.UserApi().GetUser) // 获取登陆用户信息
userApi.POST("save", api.UserApi().Save) // 新增/编辑用户信息
userApi.POST("change-password", api.UserApi().ChangePassword) // 更改密码
userApi.GET("list", api.UserApi().List) // 用户列表
userApi.PUT("change-status", api.UserApi().ChangeUserState) // 变更状态
} }
} }

View File

@ -1,10 +1,11 @@
package script package script
import ( import (
"go.uber.org/zap" "gitee.ltd/lxh/logger/log"
"wireguard-dashboard/client" "wireguard-dashboard/client"
"wireguard-dashboard/constant" "wireguard-dashboard/constant"
"wireguard-dashboard/model/entity" "wireguard-dashboard/model/entity"
"wireguard-dashboard/repository"
"wireguard-dashboard/utils" "wireguard-dashboard/utils"
) )
@ -51,27 +52,28 @@ func (s Script) CreateSuperAdmin() error {
} }
// 没有超管就创建一个 // 没有超管就创建一个
if count <= 0 { if count > 0 {
avatarPath, err := utils.Avatar().GenerateAvatar()
if err != nil {
zap.S().Errorf("生成头像失败: %v", err.Error())
return err
}
if err = client.DB.Create(&entity.User{
Avatar: avatarPath,
Name: "超牛管理员",
Account: "Admin",
Email: "",
Password: utils.Password().GenerateHashPassword("admin123"),
IsAdmin: constant.SuperAdmin,
Status: constant.Normal,
}).Error; err != nil {
zap.S().Errorf("创建管理员失败: %v", err.Error())
}
return nil return nil
} }
// 生成一下头像
avatarPath, err := utils.Avatar().GenerateAvatar()
if err != nil {
log.Errorf("生成头像失败: %v", err.Error())
return err
}
if err = repository.User().Save(&entity.User{
Avatar: avatarPath,
Name: "超牛管理员",
Account: "Admin",
Email: "",
Password: utils.Password().GenerateHashPassword("admin123"),
IsAdmin: constant.SuperAdmin,
Status: constant.Normal,
}); err != nil {
return err
}
return nil return nil
} }

View File

@ -2,7 +2,7 @@ package utils
import ( import (
"fmt" "fmt"
"go.uber.org/zap" "gitee.ltd/lxh/logger/log"
"math/rand" "math/rand"
"time" "time"
"wireguard-dashboard/client" "wireguard-dashboard/client"
@ -21,7 +21,7 @@ func (avatar) GenerateAvatar() (path string, err error) {
"eyes=variant01,variant02,variant03,variant04,variant05,variant06,variant07,variant08,variant09,variant10,variant11,variant12&mustache=variant01,variant02,variant03&"+ "eyes=variant01,variant02,variant03,variant04,variant05,variant06,variant07,variant08,variant09,variant10,variant11,variant12&mustache=variant01,variant02,variant03&"+
"topColor=000000,0fa958,699bf7", rand.Uint32())) "topColor=000000,0fa958,699bf7", rand.Uint32()))
if err != nil { if err != nil {
zap.S().Errorf("生成头像失败") log.Errorf("请求头像API失败: %v", err.Error())
return "", err return "", err
} }

View File

@ -6,6 +6,14 @@ import (
"net/http" "net/http"
) )
type PageData[T any] struct {
Current int `json:"current"` // 当前页码
Size int `json:"size"` // 每页数量
Total int64 `json:"total"` // 总数
TotalPage int `json:"totalPage"` // 总页数
Records T `json:"records"` // 返回数据
}
type ginResponse struct { type ginResponse struct {
c *gin.Context c *gin.Context
} }
@ -31,7 +39,7 @@ func (r ginResponse) Failed() {
func (r ginResponse) FailedWithErr(msg string, err error) { func (r ginResponse) FailedWithErr(msg string, err error) {
r.c.JSON(http.StatusBadRequest, gin.H{ r.c.JSON(http.StatusBadRequest, gin.H{
"code": http.StatusBadRequest, "code": http.StatusBadRequest,
"message": fmt.Errorf("%s: %s", msg, err.Error()), "message": fmt.Errorf("%s: %s", msg, err.Error()).Error(),
}) })
} }
@ -56,3 +64,19 @@ func (r ginResponse) OKWithData(data any) {
"data": data, "data": data,
}) })
} }
func (r ginResponse) OkWithPage(data any, total int64, current, size int) {
// 处理一下页码、页数量
if current == -1 {
current = 1
size = int(total)
}
// 计算总页码
totalPage := GenTotalPage(total, size)
// 返回结果
r.c.JSON(http.StatusOK, map[string]any{
"code": http.StatusOK,
"data": &PageData[any]{Current: current, Size: size, Total: total, TotalPage: totalPage, Records: data},
"message": "success",
})
}

47
utils/page.go Normal file
View File

@ -0,0 +1,47 @@
package utils
import "gorm.io/gorm"
// Page
// @description: 分页组件
// @param current
// @param size
// @return func(db *gorm.DB) *gorm.DB
func Page(current, size int) func(db *gorm.DB) *gorm.DB {
// 如果页码是-1就不分页
if current == -1 {
return func(db *gorm.DB) *gorm.DB {
return db
}
}
// 分页
return func(db *gorm.DB) *gorm.DB {
if current == 0 {
current = 1
}
if size < 1 {
size = 10
}
// 计算偏移量
offset := (current - 1) * size
// 返回组装结果
return db.Offset(offset).Limit(size)
}
}
// GenTotalPage
// @description: 计算页码数
// @param count
// @param size
// @return int
func GenTotalPage(count int64, size int) int {
totalPage := 0
if count > 0 {
upPage := 0
if int(count)%size > 0 {
upPage = 1
}
totalPage = (int(count) / size) + upPage
}
return totalPage
}