From 2a80e552cca41170726af1cad0e66a826e55d9d7 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 14 Jul 2021 14:48:27 +0200 Subject: [PATCH] Save user tokens as varchar(450) and not text to fix mysql indexing issues --- pkg/migration/20210711173657.go | 2 +- pkg/user/token.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/migration/20210711173657.go b/pkg/migration/20210711173657.go index 8391996099e..a23f08e01fd 100644 --- a/pkg/migration/20210711173657.go +++ b/pkg/migration/20210711173657.go @@ -36,7 +36,7 @@ func (u user20210711173657) TableName() string { type userTokens20210711173657 struct { ID int64 `xorm:"bigint autoincr not null unique pk"` UserID int64 `xorm:"not null"` - Token string `xorm:"TEXT not null index"` + Token string `xorm:"varchar(450) not null index"` Kind int `xorm:"not null"` Created time.Time `xorm:"created not null"` } diff --git a/pkg/user/token.go b/pkg/user/token.go index 0a999f0e1b9..1af05efebe5 100644 --- a/pkg/user/token.go +++ b/pkg/user/token.go @@ -41,7 +41,7 @@ const ( type Token struct { ID int64 `xorm:"bigint autoincr not null unique pk"` UserID int64 `xorm:"not null"` - Token string `xorm:"TEXT not null index"` + Token string `xorm:"varchar(450) not null index"` Kind TokenKind `xorm:"not null"` Created time.Time `xorm:"created not null"` }