use text for string storage in db (#173)

This commit is contained in:
饺子w 2019-03-21 16:51:14 +08:00 committed by GitHub
parent 61578d4a9d
commit c89623abd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -23,12 +23,12 @@ type Application struct {
// //
// required: true // required: true
// example: Backup Server // example: Backup Server
Name string `form:"name" query:"name" json:"name" binding:"required"` Name string `gorm:"type:text" form:"name" query:"name" json:"name" binding:"required"`
// The description of the application. // The description of the application.
// //
// required: true // required: true
// example: Backup server for the interwebs // example: Backup server for the interwebs
Description string `form:"description" query:"description" json:"description"` Description string `gorm:"type:text" form:"description" query:"description" json:"description"`
// Whether the application is an internal application. Internal applications should not be deleted. // Whether the application is an internal application. Internal applications should not be deleted.
// //
// read only: true // read only: true
@ -40,6 +40,6 @@ type Application struct {
// read only: true // read only: true
// required: true // required: true
// example: image/image.jpeg // example: image/image.jpeg
Image string `json:"image"` Image string `gorm:"type:text" json:"image"`
Messages []MessageExternal `json:"-"` Messages []MessageExternal `json:"-"`
} }

View File

@ -23,5 +23,5 @@ type Client struct {
// //
// required: true // required: true
// example: Android Phone // example: Android Phone
Name string `form:"name" query:"name" json:"name" binding:"required"` Name string `gorm:"type:text" form:"name" query:"name" json:"name" binding:"required"`
} }

View File

@ -8,8 +8,8 @@ import (
type Message struct { type Message struct {
ID uint `gorm:"AUTO_INCREMENT;primary_key;index"` ID uint `gorm:"AUTO_INCREMENT;primary_key;index"`
ApplicationID uint ApplicationID uint
Message string Message string `gorm:"type:text"`
Title string Title string `gorm:"type:text"`
Priority int Priority int
Extras []byte Extras []byte
Date time.Time Date time.Time

View File

@ -4,7 +4,7 @@ package model
type PluginConf struct { type PluginConf struct {
ID uint `gorm:"primary_key;AUTO_INCREMENT;index"` ID uint `gorm:"primary_key;AUTO_INCREMENT;index"`
UserID uint UserID uint
ModulePath string ModulePath string `gorm:"type:text"`
Token string `gorm:"unique_index"` Token string `gorm:"unique_index"`
ApplicationID uint ApplicationID uint
Enabled bool Enabled bool