limit indexed string field to 180 char (#184)

This commit is contained in:
饺子w 2019-04-13 23:20:09 +08:00 committed by GitHub
parent 2ad7409750
commit 909fb80d48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View File

@ -17,7 +17,7 @@ type Application struct {
// read only: true
// required: true
// example: AWH0wZ5r0Mbac.r
Token string `gorm:"unique_index" json:"token"`
Token string `gorm:"type:varchar(180);unique_index" json:"token"`
UserID uint `gorm:"index" json:"-"`
// The application name. This is how the application should be displayed to the user.
//

View File

@ -17,7 +17,7 @@ type Client struct {
// read only: true
// required: true
// example: CWH0wZ5r0Mbac.r
Token string `gorm:"unique_index" json:"token"`
Token string `gorm:"type:varchar(180);unique_index" json:"token"`
UserID uint `gorm:"index" json:"-"`
// The client name. This is how the client should be displayed to the user.
//

View File

@ -5,7 +5,7 @@ type PluginConf struct {
ID uint `gorm:"primary_key;AUTO_INCREMENT;index"`
UserID uint
ModulePath string `gorm:"type:text"`
Token string `gorm:"unique_index"`
Token string `gorm:"type:varchar(180);unique_index"`
ApplicationID uint
Enabled bool
Config []byte

View File

@ -3,7 +3,7 @@ package model
// The User holds information about the credentials of a user and its application and client tokens.
type User struct {
ID uint `gorm:"primary_key;unique_index;AUTO_INCREMENT"`
Name string `gorm:"unique_index"`
Name string `gorm:"type:varchar(180);unique_index"`
Pass []byte
Admin bool
Applications []Application