1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-14 01:34:47 +08:00

fix: 移除 gorm 类型参数 (#6123)

This commit is contained in:
ssongliu 2024-08-14 10:43:32 +08:00 committed by GitHub
parent 6da0445509
commit 46fda7ecfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 199 additions and 200 deletions

View File

@ -13,7 +13,7 @@ type WebsiteDTO struct {
SitePath string `json:"sitePath"` SitePath string `json:"sitePath"`
AppName string `json:"appName"` AppName string `json:"appName"`
RuntimeName string `json:"runtimeName"` RuntimeName string `json:"runtimeName"`
SiteDir string `gorm:"type:varchar;" json:"siteDir"` SiteDir string `json:"siteDir"`
} }
type WebsiteRes struct { type WebsiteRes struct {

View File

@ -9,23 +9,23 @@ import (
type App struct { type App struct {
BaseModel BaseModel
Name string `json:"name" gorm:"type:varchar(64);not null"` Name string `json:"name" gorm:"not null"`
Key string `json:"key" gorm:"type:varchar(64);not null;"` Key string `json:"key" gorm:"not null;"`
ShortDescZh string `json:"shortDescZh" yaml:"shortDescZh" gorm:"type:longtext;"` ShortDescZh string `json:"shortDescZh" yaml:"shortDescZh"`
ShortDescEn string `json:"shortDescEn" yaml:"shortDescEn" gorm:"type:longtext;"` ShortDescEn string `json:"shortDescEn" yaml:"shortDescEn"`
Icon string `json:"icon" gorm:"type:longtext;"` Icon string `json:"icon"`
Type string `json:"type" gorm:"type:varchar(64);not null"` Type string `json:"type" gorm:"not null"`
Status string `json:"status" gorm:"type:varchar(64);not null"` Status string `json:"status" gorm:"not null"`
Required string `json:"required" gorm:"type:varchar(64);"` Required string `json:"required"`
CrossVersionUpdate bool `json:"crossVersionUpdate" yaml:"crossVersionUpdate"` CrossVersionUpdate bool `json:"crossVersionUpdate" yaml:"crossVersionUpdate"`
Limit int `json:"limit" gorm:"type:Integer;not null"` Limit int `json:"limit" gorm:"not null"`
Website string `json:"website" gorm:"type:varchar(64);not null"` Website string `json:"website" gorm:"not null"`
Github string `json:"github" gorm:"type:varchar(64);not null"` Github string `json:"github" gorm:"not null"`
Document string `json:"document" gorm:"type:varchar(64);not null"` Document string `json:"document" gorm:"not null"`
Recommend int `json:"recommend" gorm:"type:Integer;not null"` Recommend int `json:"recommend" gorm:"not null"`
Resource string `json:"resource" gorm:"type:varchar;not null;default:remote"` Resource string `json:"resource" gorm:"not null;default:remote"`
ReadMe string `json:"readMe" gorm:"type:varchar;"` ReadMe string `json:"readMe"`
LastModified int `json:"lastModified" gorm:"type:Integer;"` LastModified int `json:"lastModified"`
Details []AppDetail `json:"-" gorm:"-:migration"` Details []AppDetail `json:"-" gorm:"-:migration"`
TagsKey []string `json:"tags" yaml:"tags" gorm:"-"` TagsKey []string `json:"tags" yaml:"tags" gorm:"-"`

View File

@ -2,15 +2,15 @@ package model
type AppDetail struct { type AppDetail struct {
BaseModel BaseModel
AppId uint `json:"appId" gorm:"type:integer;not null"` AppId uint `json:"appId" gorm:"not null"`
Version string `json:"version" gorm:"type:varchar(64);not null"` Version string `json:"version" gorm:"not null"`
Params string `json:"-" gorm:"type:longtext;"` Params string `json:"-"`
DockerCompose string `json:"dockerCompose" gorm:"type:longtext;"` DockerCompose string `json:"dockerCompose"`
Status string `json:"status" gorm:"type:varchar(64);not null"` Status string `json:"status" gorm:"not null"`
LastVersion string `json:"lastVersion" gorm:"type:varchar(64);"` LastVersion string `json:"lastVersion"`
LastModified int `json:"lastModified" gorm:"type:integer;"` LastModified int `json:"lastModified"`
DownloadUrl string `json:"downloadUrl" gorm:"type:varchar;"` DownloadUrl string `json:"downloadUrl"`
DownloadCallBackUrl string `json:"downloadCallBackUrl" gorm:"type:longtext;"` DownloadCallBackUrl string `json:"downloadCallBackUrl"`
Update bool `json:"update"` Update bool `json:"update"`
IgnoreUpgrade bool `json:"ignoreUpgrade"` IgnoreUpgrade bool `json:"ignoreUpgrade"`
} }

View File

@ -9,20 +9,20 @@ import (
type AppInstall struct { type AppInstall struct {
BaseModel BaseModel
Name string `json:"name" gorm:"type:varchar(64);not null;UNIQUE"` Name string `json:"name" gorm:"not null;UNIQUE"`
AppId uint `json:"appId" gorm:"type:integer;not null"` AppId uint `json:"appId" gorm:"not null"`
AppDetailId uint `json:"appDetailId" gorm:"type:integer;not null"` AppDetailId uint `json:"appDetailId" gorm:"not null"`
Version string `json:"version" gorm:"type:varchar(64);not null"` Version string `json:"version" gorm:"not null"`
Param string `json:"param" gorm:"type:longtext;"` Param string `json:"param"`
Env string `json:"env" gorm:"type:longtext;"` Env string `json:"env"`
DockerCompose string `json:"dockerCompose" gorm:"type:longtext;"` DockerCompose string `json:"dockerCompose" `
Status string `json:"status" gorm:"type:varchar(256);not null"` Status string `json:"status" gorm:"not null"`
Description string `json:"description" gorm:"type:varchar(256);"` Description string `json:"description"`
Message string `json:"message" gorm:"type:longtext;"` Message string `json:"message"`
ContainerName string `json:"containerName" gorm:"type:varchar(256);not null"` ContainerName string `json:"containerName" gorm:"not null"`
ServiceName string `json:"serviceName" gorm:"type:varchar(256);not null"` ServiceName string `json:"serviceName" gorm:"not null"`
HttpPort int `json:"httpPort" gorm:"type:integer;not null"` HttpPort int `json:"httpPort" gorm:"not null"`
HttpsPort int `json:"httpsPort" gorm:"type:integer;not null"` HttpsPort int `json:"httpsPort" gorm:"not null"`
App App `json:"app" gorm:"-:migration"` App App `json:"app" gorm:"-:migration"`
} }

View File

@ -2,9 +2,9 @@ package model
type AppInstallResource struct { type AppInstallResource struct {
BaseModel BaseModel
AppInstallId uint `json:"appInstallId" gorm:"type:integer;not null;"` AppInstallId uint `json:"appInstallId" gorm:"not null;"`
LinkId uint `json:"linkId" gorm:"type:integer;not null;"` LinkId uint `json:"linkId" gorm:"not null;"`
ResourceId uint `json:"resourceId" gorm:"type:integer;"` ResourceId uint `json:"resourceId"`
Key string `json:"key" gorm:"type:varchar(64);not null"` Key string `json:"key" gorm:"not null"`
From string `json:"from" gorm:"type:varchar(64);not null;default:local"` From string `json:"from" gorm:"not null;default:local"`
} }

View File

@ -2,6 +2,6 @@ package model
type AppTag struct { type AppTag struct {
BaseModel BaseModel
AppId uint `json:"appId" gorm:"type:integer;not null"` AppId uint `json:"appId" gorm:"not null"`
TagId uint `json:"tagId" gorm:"type:integer;not null"` TagId uint `json:"tagId" gorm:"not null"`
} }

View File

@ -3,12 +3,12 @@ package model
type Clam struct { type Clam struct {
BaseModel BaseModel
Name string `gorm:"type:varchar(64);not null" json:"name"` Name string `gorm:"not null" json:"name"`
Status string `gorm:"type:varchar(64)" json:"status"` Status string `json:"status"`
Path string `gorm:"type:varchar(64);not null" json:"path"` Path string `gorm:"not null" json:"path"`
InfectedStrategy string `gorm:"type:varchar(64)" json:"infectedStrategy"` InfectedStrategy string `json:"infectedStrategy"`
InfectedDir string `gorm:"type:varchar(64)" json:"infectedDir"` InfectedDir string `json:"infectedDir"`
Spec string `gorm:"type:varchar(64)" json:"spec"` Spec string `json:"spec"`
EntryID int `gorm:"type:varchar(64)" json:"entryID"` EntryID int `json:"entryID"`
Description string `gorm:"type:varchar(64)" json:"description"` Description string `json:"description"`
} }

View File

@ -2,13 +2,13 @@ package model
type Command struct { type Command struct {
BaseModel BaseModel
Name string `gorm:"type:varchar(64);unique;not null" json:"name"` Name string `gorm:"unique;not null" json:"name"`
GroupID uint `gorm:"type:decimal" json:"groupID"` GroupID uint `json:"groupID"`
Command string `gorm:"type:varchar(256);not null" json:"command"` Command string `gorm:"not null" json:"command"`
} }
type RedisCommand struct { type RedisCommand struct {
BaseModel BaseModel
Name string `gorm:"type:varchar(64);unique;not null" json:"name"` Name string `gorm:"unique;not null" json:"name"`
Command string `gorm:"type:varchar(256);not null" json:"command"` Command string `gorm:"not null" json:"command"`
} }

View File

@ -3,13 +3,13 @@ package model
type ComposeTemplate struct { type ComposeTemplate struct {
BaseModel BaseModel
Name string `gorm:"type:varchar(64);not null;unique" json:"name"` Name string `gorm:"not null;unique" json:"name"`
Description string `gorm:"type:varchar(256)" json:"description"` Description string `json:"description"`
Content string `gorm:"type:longtext" json:"content"` Content string `json:"content"`
} }
type Compose struct { type Compose struct {
BaseModel BaseModel
Name string `gorm:"type:varchar(256)" json:"name"` Name string `json:"name"`
} }

View File

@ -2,21 +2,21 @@ package model
type Database struct { type Database struct {
BaseModel BaseModel
AppInstallID uint `json:"appInstallID" gorm:"type:decimal"` AppInstallID uint `json:"appInstallID"`
Name string `json:"name" gorm:"type:varchar(64);not null;unique"` Name string `json:"name" gorm:"not null;unique"`
Type string `json:"type" gorm:"type:varchar(64);not null"` Type string `json:"type" gorm:"not null"`
Version string `json:"version" gorm:"type:varchar(64);not null"` Version string `json:"version" gorm:"not null"`
From string `json:"from" gorm:"type:varchar(64);not null"` From string `json:"from" gorm:"not null"`
Address string `json:"address" gorm:"type:varchar(64);not null"` Address string `json:"address" gorm:"not null"`
Port uint `json:"port" gorm:"type:decimal;not null"` Port uint `json:"port" gorm:"not null"`
Username string `json:"username" gorm:"type:varchar(64)"` Username string `json:"username"`
Password string `json:"password" gorm:"type:varchar(64)"` Password string `json:"password"`
SSL bool `json:"ssl"` SSL bool `json:"ssl"`
RootCert string `json:"rootCert" gorm:"type:longText"` RootCert string `json:"rootCert"`
ClientKey string `json:"clientKey" gorm:"type:longText"` ClientKey string `json:"clientKey"`
ClientCert string `json:"clientCert" gorm:"type:longText"` ClientCert string `json:"clientCert"`
SkipVerify bool `json:"skipVerify"` SkipVerify bool `json:"skipVerify"`
Description string `json:"description" gorm:"type:varchar(256);"` Description string `json:"description"`
} }

View File

@ -2,13 +2,13 @@ package model
type DatabaseMysql struct { type DatabaseMysql struct {
BaseModel BaseModel
Name string `json:"name" gorm:"type:varchar(256);not null"` Name string `json:"name" gorm:"not null"`
From string `json:"from" gorm:"type:varchar(256);not null;default:local"` From string `json:"from" gorm:"not null;default:local"`
MysqlName string `json:"mysqlName" gorm:"type:varchar(64);not null"` MysqlName string `json:"mysqlName" gorm:"not null"`
Format string `json:"format" gorm:"type:varchar(64);not null"` Format string `json:"format" gorm:"not null"`
Username string `json:"username" gorm:"type:varchar(256);not null"` Username string `json:"username" gorm:"not null"`
Password string `json:"password" gorm:"type:varchar(256);not null"` Password string `json:"password" gorm:"not null"`
Permission string `json:"permission" gorm:"type:varchar(256);not null"` Permission string `json:"permission" gorm:"not null"`
IsDelete bool `json:"isDelete" gorm:"type:varchar(64)"` IsDelete bool `json:"isDelete"`
Description string `json:"description" gorm:"type:varchar(256);"` Description string `json:"description"`
} }

View File

@ -2,13 +2,13 @@ package model
type DatabasePostgresql struct { type DatabasePostgresql struct {
BaseModel BaseModel
Name string `json:"name" gorm:"type:varchar(256);not null"` Name string `json:"name" gorm:"not null"`
From string `json:"from" gorm:"type:varchar(256);not null;default:local"` From string `json:"from" gorm:"not null;default:local"`
PostgresqlName string `json:"postgresqlName" gorm:"type:varchar(64);not null"` PostgresqlName string `json:"postgresqlName" gorm:"not null"`
Format string `json:"format" gorm:"type:varchar(64);not null"` Format string `json:"format" gorm:"not null"`
Username string `json:"username" gorm:"type:varchar(256);not null"` Username string `json:"username" gorm:"not null"`
Password string `json:"password" gorm:"type:varchar(256);not null"` Password string `json:"password" gorm:"not null"`
SuperUser bool `json:"superUser" gorm:"type:varchar(64)"` SuperUser bool `json:"superUser"`
IsDelete bool `json:"isDelete" gorm:"type:varchar(64)"` IsDelete bool `json:"isDelete"`
Description string `json:"description" gorm:"type:varchar(256);"` Description string `json:"description"`
} }

View File

@ -2,9 +2,9 @@ package model
type Favorite struct { type Favorite struct {
BaseModel BaseModel
Name string `gorm:"type:varchar(256);not null;" json:"name" ` Name string `gorm:"not null;" json:"name" `
Path string `gorm:"type:varchar(256);not null;unique" json:"path"` Path string `gorm:"not null;unique" json:"path"`
Type string `gorm:"type:varchar(64);" json:"type"` Type string `json:"type"`
IsDir bool `json:"isDir"` IsDir bool `json:"isDir"`
IsTxt bool `json:"isTxt"` IsTxt bool `json:"isTxt"`
} }

View File

@ -3,19 +3,19 @@ package model
type Firewall struct { type Firewall struct {
BaseModel BaseModel
Type string `gorm:"type:varchar(64);not null" json:"type"` Type string `gorm:"not null" json:"type"`
Port string `gorm:"type:varchar(64);not null" json:"port"` Port string `gorm:"not null" json:"port"`
Protocol string `gorm:"type:varchar(64);not null" json:"protocol"` Protocol string `gorm:"not null" json:"protocol"`
Address string `gorm:"type:varchar(64);not null" json:"address"` Address string `gorm:"not null" json:"address"`
Strategy string `gorm:"type:varchar(64);not null" json:"strategy"` Strategy string `gorm:"not null" json:"strategy"`
Description string `gorm:"type:varchar(64);not null" json:"description"` Description string `gorm:"not null" json:"description"`
} }
type Forward struct { type Forward struct {
BaseModel BaseModel
Protocol string `gorm:"type:varchar(64);not null" json:"protocol"` Protocol string `gorm:"not null" json:"protocol"`
Port string `gorm:"type:varchar(64);not null" json:"port"` Port string `gorm:"not null" json:"port"`
TargetIP string `gorm:"type:varchar(64);not null" json:"targetIP"` TargetIP string `gorm:"not null" json:"targetIP"`
TargetPort string `gorm:"type:varchar(64);not null" json:"targetPort"` TargetPort string `gorm:"not null" json:"targetPort"`
} }

View File

@ -3,9 +3,9 @@ package model
type Ftp struct { type Ftp struct {
BaseModel BaseModel
User string `gorm:"type:varchar(64);not null" json:"user"` User string `gorm:"not null" json:"user"`
Password string `gorm:"type:varchar(64);not null" json:"password"` Password string `gorm:"not null" json:"password"`
Status string `gorm:"type:varchar(64);not null" json:"status"` Status string `gorm:"not null" json:"status"`
Path string `gorm:"type:varchar(64);not null" json:"path"` Path string `gorm:"not null" json:"path"`
Description string `gorm:"type:varchar(64);not null" json:"description"` Description string `gorm:"not null" json:"description"`
} }

View File

@ -3,6 +3,6 @@ package model
type Group struct { type Group struct {
BaseModel BaseModel
IsDefault bool `json:"isDefault"` IsDefault bool `json:"isDefault"`
Name string `gorm:"type:varchar(64);not null" json:"name"` Name string `gorm:"not null" json:"name"`
Type string `gorm:"type:varchar(16);not null" json:"type"` Type string `gorm:"not null" json:"type"`
} }

View File

@ -3,16 +3,16 @@ package model
type Host struct { type Host struct {
BaseModel BaseModel
GroupID uint `gorm:"type:decimal;not null" json:"group_id"` GroupID uint `gorm:"not null" json:"group_id"`
Name string `gorm:"type:varchar(64);not null" json:"name"` Name string `gorm:"not null" json:"name"`
Addr string `gorm:"type:varchar(16);not null" json:"addr"` Addr string `gorm:"not null" json:"addr"`
Port int `gorm:"type:decimal;not null" json:"port"` Port int `gorm:"not null" json:"port"`
User string `gorm:"type:varchar(64);not null" json:"user"` User string `gorm:"not null" json:"user"`
AuthMode string `gorm:"type:varchar(16);not null" json:"authMode"` AuthMode string `gorm:"not null" json:"authMode"`
Password string `gorm:"type:varchar(64)" json:"password"` Password string `json:"password"`
PrivateKey string `gorm:"type:varchar(256)" json:"privateKey"` PrivateKey string `json:"privateKey"`
PassPhrase string `gorm:"type:varchar(256)" json:"passPhrase"` PassPhrase string `json:"passPhrase"`
RememberPassword bool `json:"rememberPassword"` RememberPassword bool `json:"rememberPassword"`
Description string `gorm:"type:varchar(256)" json:"description"` Description string `json:"description"`
} }

View File

@ -3,13 +3,13 @@ package model
type ImageRepo struct { type ImageRepo struct {
BaseModel BaseModel
Name string `gorm:"type:varchar(64);not null" json:"name"` Name string `gorm:"not null" json:"name"`
DownloadUrl string `gorm:"type:varchar(256)" json:"downloadUrl"` DownloadUrl string `json:"downloadUrl"`
Protocol string `gorm:"type:varchar(64)" json:"protocol"` Protocol string `json:"protocol"`
Username string `gorm:"type:varchar(256)" json:"username"` Username string `json:"username"`
Password string `gorm:"type:varchar(256)" json:"password"` Password string `json:"password"`
Auth bool `gorm:"type:varchar(256)" json:"auth"` Auth bool `json:"auth"`
Status string `gorm:"type:varchar(64)" json:"status"` Status string `json:"status"`
Message string `gorm:"type:varchar(256)" json:"message"` Message string `json:"message"`
} }

View File

@ -2,14 +2,14 @@ package model
type MonitorBase struct { type MonitorBase struct {
BaseModel BaseModel
Cpu float64 `gorm:"type:float" json:"cpu"` Cpu float64 `json:"cpu"`
LoadUsage float64 `gorm:"type:float" json:"loadUsage"` LoadUsage float64 `json:"loadUsage"`
CpuLoad1 float64 `gorm:"type:float" json:"cpuLoad1"` CpuLoad1 float64 `json:"cpuLoad1"`
CpuLoad5 float64 `gorm:"type:float" json:"cpuLoad5"` CpuLoad5 float64 `json:"cpuLoad5"`
CpuLoad15 float64 `gorm:"type:float" json:"cpuLoad15"` CpuLoad15 float64 `json:"cpuLoad15"`
Memory float64 `gorm:"type:float" json:"memory"` Memory float64 `json:"memory"`
} }
type MonitorIO struct { type MonitorIO struct {
@ -24,6 +24,6 @@ type MonitorIO struct {
type MonitorNetwork struct { type MonitorNetwork struct {
BaseModel BaseModel
Name string `json:"name"` Name string `json:"name"`
Up float64 `gorm:"type:float" json:"up"` Up float64 `json:"up"`
Down float64 `gorm:"type:float" json:"down"` Down float64 `json:"down"`
} }

View File

@ -2,6 +2,6 @@ package model
type PHPExtensions struct { type PHPExtensions struct {
BaseModel BaseModel
Name string ` json:"name" gorm:"not null"` Name string `json:"name" gorm:"not null"`
Extensions string `json:"extensions" gorm:"not null"` Extensions string `json:"extensions" gorm:"not null"`
} }

View File

@ -8,20 +8,20 @@ import (
type Runtime struct { type Runtime struct {
BaseModel BaseModel
Name string `gorm:"type:varchar;not null" json:"name"` Name string `gorm:"not null" json:"name"`
AppDetailID uint `gorm:"type:integer" json:"appDetailId"` AppDetailID uint `json:"appDetailId"`
Image string `gorm:"type:varchar" json:"image"` Image string `json:"image"`
WorkDir string `gorm:"type:varchar" json:"workDir"` WorkDir string `json:"workDir"`
DockerCompose string `gorm:"type:varchar" json:"dockerCompose"` DockerCompose string `json:"dockerCompose"`
Env string `gorm:"type:varchar" json:"env"` Env string `json:"env"`
Params string `gorm:"type:varchar" json:"params"` Params string `json:"params"`
Version string `gorm:"type:varchar;not null" json:"version"` Version string `gorm:"not null" json:"version"`
Type string `gorm:"type:varchar;not null" json:"type"` Type string `gorm:"not null" json:"type"`
Status string `gorm:"type:varchar;not null" json:"status"` Status string `gorm:"not null" json:"status"`
Resource string `gorm:"type:varchar;not null" json:"resource"` Resource string `gorm:"not null" json:"resource"`
Port int `gorm:"type:integer;" json:"port"` Port int `json:"port"`
Message string `gorm:"type:longtext;" json:"message"` Message string `json:"message"`
CodeDir string `gorm:"type:varchar;" json:"codeDir"` CodeDir string `json:"codeDir"`
} }
func (r *Runtime) GetComposePath() string { func (r *Runtime) GetComposePath() string {

View File

@ -2,7 +2,7 @@ package model
type Setting struct { type Setting struct {
BaseModel BaseModel
Key string `json:"key" gorm:"type:varchar(256);not null;"` Key string `json:"key" gorm:"not null;"`
Value string `json:"value" gorm:"type:varchar(256)"` Value string `json:"value"`
About string `json:"about" gorm:"type:longText"` About string `json:"about"`
} }

View File

@ -2,7 +2,7 @@ package model
type Tag struct { type Tag struct {
BaseModel BaseModel
Key string `json:"key" gorm:"type:varchar(64);not null"` Key string `json:"key" gorm:"not null"`
Name string `json:"name" gorm:"type:varchar(64);not null"` Name string `json:"name" gorm:"not null"`
Sort int `json:"sort" gorm:"type:int;not null;default:1"` Sort int `json:"sort" gorm:"not null;default:1"`
} }

View File

@ -2,9 +2,9 @@ package model
type WebsiteDnsAccount struct { type WebsiteDnsAccount struct {
BaseModel BaseModel
Name string `gorm:"type:varchar(64);not null" json:"name"` Name string `gorm:"not null" json:"name"`
Type string `gorm:"type:varchar(64);not null" json:"type"` Type string `gorm:"not null" json:"type"`
Authorization string `gorm:"type:varchar(256);not null" json:"-"` Authorization string `gorm:"not null" json:"-"`
} }
func (w WebsiteDnsAccount) TableName() string { func (w WebsiteDnsAccount) TableName() string {

View File

@ -2,10 +2,10 @@ package model
type WebsiteDomain struct { type WebsiteDomain struct {
BaseModel BaseModel
WebsiteID uint `gorm:"column:website_id;type:varchar(64);not null;" json:"websiteId"` WebsiteID uint `gorm:"column:website_id;not null;" json:"websiteId"`
Domain string `gorm:"type:varchar(256);not null" json:"domain"` Domain string `gorm:"not null" json:"domain"`
SSL bool `json:"ssl"` SSL bool `json:"ssl"`
Port int `gorm:"type:integer" json:"port"` Port int `json:"port"`
} }
func (w WebsiteDomain) TableName() string { func (w WebsiteDomain) TableName() string {

View File

@ -28,9 +28,9 @@ type setting struct {
ID uint `gorm:"primarykey;AUTO_INCREMENT" json:"id"` ID uint `gorm:"primarykey;AUTO_INCREMENT" json:"id"`
CreatedAt time.Time `json:"createdAt"` CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"` UpdatedAt time.Time `json:"updatedAt"`
Key string `json:"key" gorm:"type:varchar(256);not null;"` Key string `json:"key" gorm:"not null;"`
Value string `json:"value" gorm:"type:varchar(256)"` Value string `json:"value"`
About string `json:"about" gorm:"type:longText"` About string `json:"about"`
} }
func loadDBConn() (*gorm.DB, error) { func loadDBConn() (*gorm.DB, error) {

View File

@ -2,15 +2,15 @@ package model
type BackupAccount struct { type BackupAccount struct {
BaseModel BaseModel
Name string `gorm:"type:varchar(64);unique;not null" json:"name"` Name string `gorm:"unique;not null" json:"name"`
Type string `gorm:"type:varchar(64);unique;not null" json:"type"` Type string `gorm:"unique;not null" json:"type"`
Bucket string `gorm:"type:varchar(256)" json:"bucket"` Bucket string `json:"bucket"`
AccessKey string `gorm:"type:varchar(256)" json:"accessKey"` AccessKey string `json:"accessKey"`
Credential string `gorm:"type:varchar(256)" json:"credential"` Credential string `json:"credential"`
BackupPath string `gorm:"type:varchar(256)" json:"backupPath"` BackupPath string `json:"backupPath"`
Vars string `gorm:"type:longText" json:"vars"` Vars string `json:"vars"`
RememberAuth bool `gorm:"type:varchar(64)" json:"rememberAuth"` RememberAuth bool `json:"rememberAuth"`
InUsed bool `gorm:"type:varchar(64)" json:"inUsed"` InUsed bool `json:"inUsed"`
EntryID uint `gorm:"type:varchar(64)" json:"entryID"` EntryID uint `json:"entryID"`
} }

View File

@ -6,26 +6,25 @@ import (
type OperationLog struct { type OperationLog struct {
BaseModel BaseModel
Source string `gorm:"type:varchar(64)" json:"source"` Source string `json:"source"`
IP string `json:"ip"`
Path string `json:"path"`
Method string `json:"method"`
UserAgent string `json:"userAgent"`
IP string `gorm:"type:varchar(64)" json:"ip"` Latency time.Duration `json:"latency"`
Path string `gorm:"type:varchar(64)" json:"path"` Status string `json:"status"`
Method string `gorm:"type:varchar(64)" json:"method"` Message string `json:"message"`
UserAgent string `gorm:"type:varchar(256)" json:"userAgent"`
Latency time.Duration `gorm:"type:varchar(64)" json:"latency"` DetailZH string `json:"detailZH"`
Status string `gorm:"type:varchar(64)" json:"status"` DetailEN string `json:"detailEN"`
Message string `gorm:"type:varchar(256)" json:"message"`
DetailZH string `gorm:"type:varchar(256)" json:"detailZH"`
DetailEN string `gorm:"type:varchar(256)" json:"detailEN"`
} }
type LoginLog struct { type LoginLog struct {
BaseModel BaseModel
IP string `gorm:"type:varchar(64)" json:"ip"` IP string `json:"ip"`
Address string `gorm:"type:varchar(64)" json:"address"` Address string `json:"address"`
Agent string `gorm:"type:varchar(256)" json:"agent"` Agent string `json:"agent"`
Status string `gorm:"type:varchar(64)" json:"status"` Status string `json:"status"`
Message string `gorm:"type:longText" json:"message"` Message string `json:"message"`
} }

View File

@ -2,7 +2,7 @@ package model
type Setting struct { type Setting struct {
BaseModel BaseModel
Key string `json:"key" gorm:"type:varchar(256);not null;"` Key string `json:"key" gorm:"not null;"`
Value string `json:"value" gorm:"type:varchar(256)"` Value string `json:"value"`
About string `json:"about" gorm:"type:longText"` About string `json:"about"`
} }