Skip to content

Commit 909fb80

Browse files
author
饺子w
authored
limit indexed string field to 180 char (#184)
1 parent 2ad7409 commit 909fb80

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

model/application.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type Application struct {
1717
// read only: true
1818
// required: true
1919
// example: AWH0wZ5r0Mbac.r
20-
Token string `gorm:"unique_index" json:"token"`
20+
Token string `gorm:"type:varchar(180);unique_index" json:"token"`
2121
UserID uint `gorm:"index" json:"-"`
2222
// The application name. This is how the application should be displayed to the user.
2323
//

model/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type Client struct {
1717
// read only: true
1818
// required: true
1919
// example: CWH0wZ5r0Mbac.r
20-
Token string `gorm:"unique_index" json:"token"`
20+
Token string `gorm:"type:varchar(180);unique_index" json:"token"`
2121
UserID uint `gorm:"index" json:"-"`
2222
// The client name. This is how the client should be displayed to the user.
2323
//

model/pluginconf.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type PluginConf struct {
55
ID uint `gorm:"primary_key;AUTO_INCREMENT;index"`
66
UserID uint
77
ModulePath string `gorm:"type:text"`
8-
Token string `gorm:"unique_index"`
8+
Token string `gorm:"type:varchar(180);unique_index"`
99
ApplicationID uint
1010
Enabled bool
1111
Config []byte

model/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package model
33
// The User holds information about the credentials of a user and its application and client tokens.
44
type User struct {
55
ID uint `gorm:"primary_key;unique_index;AUTO_INCREMENT"`
6-
Name string `gorm:"unique_index"`
6+
Name string `gorm:"type:varchar(180);unique_index"`
77
Pass []byte
88
Admin bool
99
Applications []Application

0 commit comments

Comments
 (0)