diff --git a/agent/app/dto/response/website.go b/agent/app/dto/response/website.go index 45c2c2c6d..b05c9b0bf 100644 --- a/agent/app/dto/response/website.go +++ b/agent/app/dto/response/website.go @@ -13,7 +13,7 @@ type WebsiteDTO struct { SitePath string `json:"sitePath"` AppName string `json:"appName"` RuntimeName string `json:"runtimeName"` - SiteDir string `gorm:"type:varchar;" json:"siteDir"` + SiteDir string `json:"siteDir"` } type WebsiteRes struct { diff --git a/agent/app/model/app.go b/agent/app/model/app.go index a5d1bc391..63ac65569 100644 --- a/agent/app/model/app.go +++ b/agent/app/model/app.go @@ -9,23 +9,23 @@ import ( type App struct { BaseModel - Name string `json:"name" gorm:"type:varchar(64);not null"` - Key string `json:"key" gorm:"type:varchar(64);not null;"` - ShortDescZh string `json:"shortDescZh" yaml:"shortDescZh" gorm:"type:longtext;"` - ShortDescEn string `json:"shortDescEn" yaml:"shortDescEn" gorm:"type:longtext;"` - Icon string `json:"icon" gorm:"type:longtext;"` - Type string `json:"type" gorm:"type:varchar(64);not null"` - Status string `json:"status" gorm:"type:varchar(64);not null"` - Required string `json:"required" gorm:"type:varchar(64);"` + Name string `json:"name" gorm:"not null"` + Key string `json:"key" gorm:"not null;"` + ShortDescZh string `json:"shortDescZh" yaml:"shortDescZh"` + ShortDescEn string `json:"shortDescEn" yaml:"shortDescEn"` + Icon string `json:"icon"` + Type string `json:"type" gorm:"not null"` + Status string `json:"status" gorm:"not null"` + Required string `json:"required"` CrossVersionUpdate bool `json:"crossVersionUpdate" yaml:"crossVersionUpdate"` - Limit int `json:"limit" gorm:"type:Integer;not null"` - Website string `json:"website" gorm:"type:varchar(64);not null"` - Github string `json:"github" gorm:"type:varchar(64);not null"` - Document string `json:"document" gorm:"type:varchar(64);not null"` - Recommend int `json:"recommend" gorm:"type:Integer;not null"` - Resource string `json:"resource" gorm:"type:varchar;not null;default:remote"` - ReadMe string `json:"readMe" gorm:"type:varchar;"` - LastModified int `json:"lastModified" gorm:"type:Integer;"` + Limit int `json:"limit" gorm:"not null"` + Website string `json:"website" gorm:"not null"` + Github string `json:"github" gorm:"not null"` + Document string `json:"document" gorm:"not null"` + Recommend int `json:"recommend" gorm:"not null"` + Resource string `json:"resource" gorm:"not null;default:remote"` + ReadMe string `json:"readMe"` + LastModified int `json:"lastModified"` Details []AppDetail `json:"-" gorm:"-:migration"` TagsKey []string `json:"tags" yaml:"tags" gorm:"-"` diff --git a/agent/app/model/app_detail.go b/agent/app/model/app_detail.go index d6b958284..80fd23dfb 100644 --- a/agent/app/model/app_detail.go +++ b/agent/app/model/app_detail.go @@ -2,15 +2,15 @@ package model type AppDetail struct { BaseModel - AppId uint `json:"appId" gorm:"type:integer;not null"` - Version string `json:"version" gorm:"type:varchar(64);not null"` - Params string `json:"-" gorm:"type:longtext;"` - DockerCompose string `json:"dockerCompose" gorm:"type:longtext;"` - Status string `json:"status" gorm:"type:varchar(64);not null"` - LastVersion string `json:"lastVersion" gorm:"type:varchar(64);"` - LastModified int `json:"lastModified" gorm:"type:integer;"` - DownloadUrl string `json:"downloadUrl" gorm:"type:varchar;"` - DownloadCallBackUrl string `json:"downloadCallBackUrl" gorm:"type:longtext;"` + AppId uint `json:"appId" gorm:"not null"` + Version string `json:"version" gorm:"not null"` + Params string `json:"-"` + DockerCompose string `json:"dockerCompose"` + Status string `json:"status" gorm:"not null"` + LastVersion string `json:"lastVersion"` + LastModified int `json:"lastModified"` + DownloadUrl string `json:"downloadUrl"` + DownloadCallBackUrl string `json:"downloadCallBackUrl"` Update bool `json:"update"` IgnoreUpgrade bool `json:"ignoreUpgrade"` } diff --git a/agent/app/model/app_install.go b/agent/app/model/app_install.go index 3d3829952..1a88b781b 100644 --- a/agent/app/model/app_install.go +++ b/agent/app/model/app_install.go @@ -9,20 +9,20 @@ import ( type AppInstall struct { BaseModel - Name string `json:"name" gorm:"type:varchar(64);not null;UNIQUE"` - AppId uint `json:"appId" gorm:"type:integer;not null"` - AppDetailId uint `json:"appDetailId" gorm:"type:integer;not null"` - Version string `json:"version" gorm:"type:varchar(64);not null"` - Param string `json:"param" gorm:"type:longtext;"` - Env string `json:"env" gorm:"type:longtext;"` - DockerCompose string `json:"dockerCompose" gorm:"type:longtext;"` - Status string `json:"status" gorm:"type:varchar(256);not null"` - Description string `json:"description" gorm:"type:varchar(256);"` - Message string `json:"message" gorm:"type:longtext;"` - ContainerName string `json:"containerName" gorm:"type:varchar(256);not null"` - ServiceName string `json:"serviceName" gorm:"type:varchar(256);not null"` - HttpPort int `json:"httpPort" gorm:"type:integer;not null"` - HttpsPort int `json:"httpsPort" gorm:"type:integer;not null"` + Name string `json:"name" gorm:"not null;UNIQUE"` + AppId uint `json:"appId" gorm:"not null"` + AppDetailId uint `json:"appDetailId" gorm:"not null"` + Version string `json:"version" gorm:"not null"` + Param string `json:"param"` + Env string `json:"env"` + DockerCompose string `json:"dockerCompose" ` + Status string `json:"status" gorm:"not null"` + Description string `json:"description"` + Message string `json:"message"` + ContainerName string `json:"containerName" gorm:"not null"` + ServiceName string `json:"serviceName" gorm:"not null"` + HttpPort int `json:"httpPort" gorm:"not null"` + HttpsPort int `json:"httpsPort" gorm:"not null"` App App `json:"app" gorm:"-:migration"` } diff --git a/agent/app/model/app_install_resource.go b/agent/app/model/app_install_resource.go index 863090459..5ada945fb 100644 --- a/agent/app/model/app_install_resource.go +++ b/agent/app/model/app_install_resource.go @@ -2,9 +2,9 @@ package model type AppInstallResource struct { BaseModel - AppInstallId uint `json:"appInstallId" gorm:"type:integer;not null;"` - LinkId uint `json:"linkId" gorm:"type:integer;not null;"` - ResourceId uint `json:"resourceId" gorm:"type:integer;"` - Key string `json:"key" gorm:"type:varchar(64);not null"` - From string `json:"from" gorm:"type:varchar(64);not null;default:local"` + AppInstallId uint `json:"appInstallId" gorm:"not null;"` + LinkId uint `json:"linkId" gorm:"not null;"` + ResourceId uint `json:"resourceId"` + Key string `json:"key" gorm:"not null"` + From string `json:"from" gorm:"not null;default:local"` } diff --git a/agent/app/model/app_tag.go b/agent/app/model/app_tag.go index 1d55b956a..6e4b13cbe 100644 --- a/agent/app/model/app_tag.go +++ b/agent/app/model/app_tag.go @@ -2,6 +2,6 @@ package model type AppTag struct { BaseModel - AppId uint `json:"appId" gorm:"type:integer;not null"` - TagId uint `json:"tagId" gorm:"type:integer;not null"` + AppId uint `json:"appId" gorm:"not null"` + TagId uint `json:"tagId" gorm:"not null"` } diff --git a/agent/app/model/clam.go b/agent/app/model/clam.go index ff1a73e67..a71fc3ed5 100644 --- a/agent/app/model/clam.go +++ b/agent/app/model/clam.go @@ -3,12 +3,12 @@ package model type Clam struct { BaseModel - Name string `gorm:"type:varchar(64);not null" json:"name"` - Status string `gorm:"type:varchar(64)" json:"status"` - Path string `gorm:"type:varchar(64);not null" json:"path"` - InfectedStrategy string `gorm:"type:varchar(64)" json:"infectedStrategy"` - InfectedDir string `gorm:"type:varchar(64)" json:"infectedDir"` - Spec string `gorm:"type:varchar(64)" json:"spec"` - EntryID int `gorm:"type:varchar(64)" json:"entryID"` - Description string `gorm:"type:varchar(64)" json:"description"` + Name string `gorm:"not null" json:"name"` + Status string `json:"status"` + Path string `gorm:"not null" json:"path"` + InfectedStrategy string `json:"infectedStrategy"` + InfectedDir string `json:"infectedDir"` + Spec string `json:"spec"` + EntryID int `json:"entryID"` + Description string `json:"description"` } diff --git a/agent/app/model/command.go b/agent/app/model/command.go index 9f00558d4..2e72e714d 100644 --- a/agent/app/model/command.go +++ b/agent/app/model/command.go @@ -2,13 +2,13 @@ package model type Command struct { BaseModel - Name string `gorm:"type:varchar(64);unique;not null" json:"name"` - GroupID uint `gorm:"type:decimal" json:"groupID"` - Command string `gorm:"type:varchar(256);not null" json:"command"` + Name string `gorm:"unique;not null" json:"name"` + GroupID uint `json:"groupID"` + Command string `gorm:"not null" json:"command"` } type RedisCommand struct { BaseModel - Name string `gorm:"type:varchar(64);unique;not null" json:"name"` - Command string `gorm:"type:varchar(256);not null" json:"command"` + Name string `gorm:"unique;not null" json:"name"` + Command string `gorm:"not null" json:"command"` } diff --git a/agent/app/model/compose_template.go b/agent/app/model/compose_template.go index 5d5192eb3..89f153b63 100644 --- a/agent/app/model/compose_template.go +++ b/agent/app/model/compose_template.go @@ -3,13 +3,13 @@ package model type ComposeTemplate struct { BaseModel - Name string `gorm:"type:varchar(64);not null;unique" json:"name"` - Description string `gorm:"type:varchar(256)" json:"description"` - Content string `gorm:"type:longtext" json:"content"` + Name string `gorm:"not null;unique" json:"name"` + Description string `json:"description"` + Content string `json:"content"` } type Compose struct { BaseModel - Name string `gorm:"type:varchar(256)" json:"name"` + Name string `json:"name"` } diff --git a/agent/app/model/database.go b/agent/app/model/database.go index f4d0ff0fc..be3230152 100644 --- a/agent/app/model/database.go +++ b/agent/app/model/database.go @@ -2,21 +2,21 @@ package model type Database struct { BaseModel - AppInstallID uint `json:"appInstallID" gorm:"type:decimal"` - Name string `json:"name" gorm:"type:varchar(64);not null;unique"` - Type string `json:"type" gorm:"type:varchar(64);not null"` - Version string `json:"version" gorm:"type:varchar(64);not null"` - From string `json:"from" gorm:"type:varchar(64);not null"` - Address string `json:"address" gorm:"type:varchar(64);not null"` - Port uint `json:"port" gorm:"type:decimal;not null"` - Username string `json:"username" gorm:"type:varchar(64)"` - Password string `json:"password" gorm:"type:varchar(64)"` + AppInstallID uint `json:"appInstallID"` + Name string `json:"name" gorm:"not null;unique"` + Type string `json:"type" gorm:"not null"` + Version string `json:"version" gorm:"not null"` + From string `json:"from" gorm:"not null"` + Address string `json:"address" gorm:"not null"` + Port uint `json:"port" gorm:"not null"` + Username string `json:"username"` + Password string `json:"password"` SSL bool `json:"ssl"` - RootCert string `json:"rootCert" gorm:"type:longText"` - ClientKey string `json:"clientKey" gorm:"type:longText"` - ClientCert string `json:"clientCert" gorm:"type:longText"` + RootCert string `json:"rootCert"` + ClientKey string `json:"clientKey"` + ClientCert string `json:"clientCert"` SkipVerify bool `json:"skipVerify"` - Description string `json:"description" gorm:"type:varchar(256);"` + Description string `json:"description"` } diff --git a/agent/app/model/database_mysql.go b/agent/app/model/database_mysql.go index 0a8734848..97861440c 100644 --- a/agent/app/model/database_mysql.go +++ b/agent/app/model/database_mysql.go @@ -2,13 +2,13 @@ package model type DatabaseMysql struct { BaseModel - Name string `json:"name" gorm:"type:varchar(256);not null"` - From string `json:"from" gorm:"type:varchar(256);not null;default:local"` - MysqlName string `json:"mysqlName" gorm:"type:varchar(64);not null"` - Format string `json:"format" gorm:"type:varchar(64);not null"` - Username string `json:"username" gorm:"type:varchar(256);not null"` - Password string `json:"password" gorm:"type:varchar(256);not null"` - Permission string `json:"permission" gorm:"type:varchar(256);not null"` - IsDelete bool `json:"isDelete" gorm:"type:varchar(64)"` - Description string `json:"description" gorm:"type:varchar(256);"` + Name string `json:"name" gorm:"not null"` + From string `json:"from" gorm:"not null;default:local"` + MysqlName string `json:"mysqlName" gorm:"not null"` + Format string `json:"format" gorm:"not null"` + Username string `json:"username" gorm:"not null"` + Password string `json:"password" gorm:"not null"` + Permission string `json:"permission" gorm:"not null"` + IsDelete bool `json:"isDelete"` + Description string `json:"description"` } diff --git a/agent/app/model/database_postgresql.go b/agent/app/model/database_postgresql.go index 7ea4ee59e..3568fd53f 100644 --- a/agent/app/model/database_postgresql.go +++ b/agent/app/model/database_postgresql.go @@ -2,13 +2,13 @@ package model type DatabasePostgresql struct { BaseModel - Name string `json:"name" gorm:"type:varchar(256);not null"` - From string `json:"from" gorm:"type:varchar(256);not null;default:local"` - PostgresqlName string `json:"postgresqlName" gorm:"type:varchar(64);not null"` - Format string `json:"format" gorm:"type:varchar(64);not null"` - Username string `json:"username" gorm:"type:varchar(256);not null"` - Password string `json:"password" gorm:"type:varchar(256);not null"` - SuperUser bool `json:"superUser" gorm:"type:varchar(64)"` - IsDelete bool `json:"isDelete" gorm:"type:varchar(64)"` - Description string `json:"description" gorm:"type:varchar(256);"` + Name string `json:"name" gorm:"not null"` + From string `json:"from" gorm:"not null;default:local"` + PostgresqlName string `json:"postgresqlName" gorm:"not null"` + Format string `json:"format" gorm:"not null"` + Username string `json:"username" gorm:"not null"` + Password string `json:"password" gorm:"not null"` + SuperUser bool `json:"superUser"` + IsDelete bool `json:"isDelete"` + Description string `json:"description"` } diff --git a/agent/app/model/favorite.go b/agent/app/model/favorite.go index 6e5421dcf..ee17b55a3 100644 --- a/agent/app/model/favorite.go +++ b/agent/app/model/favorite.go @@ -2,9 +2,9 @@ package model type Favorite struct { BaseModel - Name string `gorm:"type:varchar(256);not null;" json:"name" ` - Path string `gorm:"type:varchar(256);not null;unique" json:"path"` - Type string `gorm:"type:varchar(64);" json:"type"` + Name string `gorm:"not null;" json:"name" ` + Path string `gorm:"not null;unique" json:"path"` + Type string `json:"type"` IsDir bool `json:"isDir"` IsTxt bool `json:"isTxt"` } diff --git a/agent/app/model/firewall.go b/agent/app/model/firewall.go index d4979a05d..1bce122e8 100644 --- a/agent/app/model/firewall.go +++ b/agent/app/model/firewall.go @@ -3,19 +3,19 @@ package model type Firewall struct { BaseModel - Type string `gorm:"type:varchar(64);not null" json:"type"` - Port string `gorm:"type:varchar(64);not null" json:"port"` - Protocol string `gorm:"type:varchar(64);not null" json:"protocol"` - Address string `gorm:"type:varchar(64);not null" json:"address"` - Strategy string `gorm:"type:varchar(64);not null" json:"strategy"` - Description string `gorm:"type:varchar(64);not null" json:"description"` + Type string `gorm:"not null" json:"type"` + Port string `gorm:"not null" json:"port"` + Protocol string `gorm:"not null" json:"protocol"` + Address string `gorm:"not null" json:"address"` + Strategy string `gorm:"not null" json:"strategy"` + Description string `gorm:"not null" json:"description"` } type Forward struct { BaseModel - Protocol string `gorm:"type:varchar(64);not null" json:"protocol"` - Port string `gorm:"type:varchar(64);not null" json:"port"` - TargetIP string `gorm:"type:varchar(64);not null" json:"targetIP"` - TargetPort string `gorm:"type:varchar(64);not null" json:"targetPort"` + Protocol string `gorm:"not null" json:"protocol"` + Port string `gorm:"not null" json:"port"` + TargetIP string `gorm:"not null" json:"targetIP"` + TargetPort string `gorm:"not null" json:"targetPort"` } diff --git a/agent/app/model/ftp.go b/agent/app/model/ftp.go index 291e765c6..6e88a4aa8 100644 --- a/agent/app/model/ftp.go +++ b/agent/app/model/ftp.go @@ -3,9 +3,9 @@ package model type Ftp struct { BaseModel - User string `gorm:"type:varchar(64);not null" json:"user"` - Password string `gorm:"type:varchar(64);not null" json:"password"` - Status string `gorm:"type:varchar(64);not null" json:"status"` - Path string `gorm:"type:varchar(64);not null" json:"path"` - Description string `gorm:"type:varchar(64);not null" json:"description"` + User string `gorm:"not null" json:"user"` + Password string `gorm:"not null" json:"password"` + Status string `gorm:"not null" json:"status"` + Path string `gorm:"not null" json:"path"` + Description string `gorm:"not null" json:"description"` } diff --git a/agent/app/model/group.go b/agent/app/model/group.go index 1479e035a..0a6758531 100644 --- a/agent/app/model/group.go +++ b/agent/app/model/group.go @@ -3,6 +3,6 @@ package model type Group struct { BaseModel IsDefault bool `json:"isDefault"` - Name string `gorm:"type:varchar(64);not null" json:"name"` - Type string `gorm:"type:varchar(16);not null" json:"type"` + Name string `gorm:"not null" json:"name"` + Type string `gorm:"not null" json:"type"` } diff --git a/agent/app/model/host.go b/agent/app/model/host.go index a4fe6aedd..0521f5384 100644 --- a/agent/app/model/host.go +++ b/agent/app/model/host.go @@ -3,16 +3,16 @@ package model type Host struct { BaseModel - GroupID uint `gorm:"type:decimal;not null" json:"group_id"` - Name string `gorm:"type:varchar(64);not null" json:"name"` - Addr string `gorm:"type:varchar(16);not null" json:"addr"` - Port int `gorm:"type:decimal;not null" json:"port"` - User string `gorm:"type:varchar(64);not null" json:"user"` - AuthMode string `gorm:"type:varchar(16);not null" json:"authMode"` - Password string `gorm:"type:varchar(64)" json:"password"` - PrivateKey string `gorm:"type:varchar(256)" json:"privateKey"` - PassPhrase string `gorm:"type:varchar(256)" json:"passPhrase"` + GroupID uint `gorm:"not null" json:"group_id"` + Name string `gorm:"not null" json:"name"` + Addr string `gorm:"not null" json:"addr"` + Port int `gorm:"not null" json:"port"` + User string `gorm:"not null" json:"user"` + AuthMode string `gorm:"not null" json:"authMode"` + Password string `json:"password"` + PrivateKey string `json:"privateKey"` + PassPhrase string `json:"passPhrase"` RememberPassword bool `json:"rememberPassword"` - Description string `gorm:"type:varchar(256)" json:"description"` + Description string `json:"description"` } diff --git a/agent/app/model/image_repo.go b/agent/app/model/image_repo.go index 8d16dbff1..438774edd 100644 --- a/agent/app/model/image_repo.go +++ b/agent/app/model/image_repo.go @@ -3,13 +3,13 @@ package model type ImageRepo struct { BaseModel - Name string `gorm:"type:varchar(64);not null" json:"name"` - DownloadUrl string `gorm:"type:varchar(256)" json:"downloadUrl"` - Protocol string `gorm:"type:varchar(64)" json:"protocol"` - Username string `gorm:"type:varchar(256)" json:"username"` - Password string `gorm:"type:varchar(256)" json:"password"` - Auth bool `gorm:"type:varchar(256)" json:"auth"` + Name string `gorm:"not null" json:"name"` + DownloadUrl string `json:"downloadUrl"` + Protocol string `json:"protocol"` + Username string `json:"username"` + Password string `json:"password"` + Auth bool `json:"auth"` - Status string `gorm:"type:varchar(64)" json:"status"` - Message string `gorm:"type:varchar(256)" json:"message"` + Status string `json:"status"` + Message string `json:"message"` } diff --git a/agent/app/model/monitor.go b/agent/app/model/monitor.go index 1207c98af..a53392e43 100644 --- a/agent/app/model/monitor.go +++ b/agent/app/model/monitor.go @@ -2,14 +2,14 @@ package model type MonitorBase struct { BaseModel - Cpu float64 `gorm:"type:float" json:"cpu"` + Cpu float64 `json:"cpu"` - LoadUsage float64 `gorm:"type:float" json:"loadUsage"` - CpuLoad1 float64 `gorm:"type:float" json:"cpuLoad1"` - CpuLoad5 float64 `gorm:"type:float" json:"cpuLoad5"` - CpuLoad15 float64 `gorm:"type:float" json:"cpuLoad15"` + LoadUsage float64 `json:"loadUsage"` + CpuLoad1 float64 `json:"cpuLoad1"` + CpuLoad5 float64 `json:"cpuLoad5"` + CpuLoad15 float64 `json:"cpuLoad15"` - Memory float64 `gorm:"type:float" json:"memory"` + Memory float64 `json:"memory"` } type MonitorIO struct { @@ -24,6 +24,6 @@ type MonitorIO struct { type MonitorNetwork struct { BaseModel Name string `json:"name"` - Up float64 `gorm:"type:float" json:"up"` - Down float64 `gorm:"type:float" json:"down"` + Up float64 `json:"up"` + Down float64 `json:"down"` } diff --git a/agent/app/model/php_extensions.go b/agent/app/model/php_extensions.go index 0055bd258..732b1e047 100644 --- a/agent/app/model/php_extensions.go +++ b/agent/app/model/php_extensions.go @@ -2,6 +2,6 @@ package model type PHPExtensions struct { BaseModel - Name string ` json:"name" gorm:"not null"` + Name string `json:"name" gorm:"not null"` Extensions string `json:"extensions" gorm:"not null"` } diff --git a/agent/app/model/runtime.go b/agent/app/model/runtime.go index 4c9160276..7c9085c3c 100644 --- a/agent/app/model/runtime.go +++ b/agent/app/model/runtime.go @@ -8,20 +8,20 @@ import ( type Runtime struct { BaseModel - Name string `gorm:"type:varchar;not null" json:"name"` - AppDetailID uint `gorm:"type:integer" json:"appDetailId"` - Image string `gorm:"type:varchar" json:"image"` - WorkDir string `gorm:"type:varchar" json:"workDir"` - DockerCompose string `gorm:"type:varchar" json:"dockerCompose"` - Env string `gorm:"type:varchar" json:"env"` - Params string `gorm:"type:varchar" json:"params"` - Version string `gorm:"type:varchar;not null" json:"version"` - Type string `gorm:"type:varchar;not null" json:"type"` - Status string `gorm:"type:varchar;not null" json:"status"` - Resource string `gorm:"type:varchar;not null" json:"resource"` - Port int `gorm:"type:integer;" json:"port"` - Message string `gorm:"type:longtext;" json:"message"` - CodeDir string `gorm:"type:varchar;" json:"codeDir"` + Name string `gorm:"not null" json:"name"` + AppDetailID uint `json:"appDetailId"` + Image string `json:"image"` + WorkDir string `json:"workDir"` + DockerCompose string `json:"dockerCompose"` + Env string `json:"env"` + Params string `json:"params"` + Version string `gorm:"not null" json:"version"` + Type string `gorm:"not null" json:"type"` + Status string `gorm:"not null" json:"status"` + Resource string `gorm:"not null" json:"resource"` + Port int `json:"port"` + Message string `json:"message"` + CodeDir string `json:"codeDir"` } func (r *Runtime) GetComposePath() string { diff --git a/agent/app/model/setting.go b/agent/app/model/setting.go index e9791b79b..ded547895 100644 --- a/agent/app/model/setting.go +++ b/agent/app/model/setting.go @@ -2,7 +2,7 @@ package model type Setting struct { BaseModel - Key string `json:"key" gorm:"type:varchar(256);not null;"` - Value string `json:"value" gorm:"type:varchar(256)"` - About string `json:"about" gorm:"type:longText"` + Key string `json:"key" gorm:"not null;"` + Value string `json:"value"` + About string `json:"about"` } diff --git a/agent/app/model/tag.go b/agent/app/model/tag.go index adc8d6ec4..2afc4d9b5 100644 --- a/agent/app/model/tag.go +++ b/agent/app/model/tag.go @@ -2,7 +2,7 @@ package model type Tag struct { BaseModel - Key string `json:"key" gorm:"type:varchar(64);not null"` - Name string `json:"name" gorm:"type:varchar(64);not null"` - Sort int `json:"sort" gorm:"type:int;not null;default:1"` + Key string `json:"key" gorm:"not null"` + Name string `json:"name" gorm:"not null"` + Sort int `json:"sort" gorm:"not null;default:1"` } diff --git a/agent/app/model/website_dns_account.go b/agent/app/model/website_dns_account.go index de7ae8dee..0dfce6ec8 100644 --- a/agent/app/model/website_dns_account.go +++ b/agent/app/model/website_dns_account.go @@ -2,9 +2,9 @@ package model type WebsiteDnsAccount struct { BaseModel - Name string `gorm:"type:varchar(64);not null" json:"name"` - Type string `gorm:"type:varchar(64);not null" json:"type"` - Authorization string `gorm:"type:varchar(256);not null" json:"-"` + Name string `gorm:"not null" json:"name"` + Type string `gorm:"not null" json:"type"` + Authorization string `gorm:"not null" json:"-"` } func (w WebsiteDnsAccount) TableName() string { diff --git a/agent/app/model/website_domain.go b/agent/app/model/website_domain.go index 6fd872b4a..155d164ae 100644 --- a/agent/app/model/website_domain.go +++ b/agent/app/model/website_domain.go @@ -2,10 +2,10 @@ package model type WebsiteDomain struct { BaseModel - WebsiteID uint `gorm:"column:website_id;type:varchar(64);not null;" json:"websiteId"` - Domain string `gorm:"type:varchar(256);not null" json:"domain"` + WebsiteID uint `gorm:"column:website_id;not null;" json:"websiteId"` + Domain string `gorm:"not null" json:"domain"` SSL bool `json:"ssl"` - Port int `gorm:"type:integer" json:"port"` + Port int `json:"port"` } func (w WebsiteDomain) TableName() string { diff --git a/cmd/server/cmd/root.go b/cmd/server/cmd/root.go index 7063cac42..c683950ab 100644 --- a/cmd/server/cmd/root.go +++ b/cmd/server/cmd/root.go @@ -28,9 +28,9 @@ type setting struct { ID uint `gorm:"primarykey;AUTO_INCREMENT" json:"id"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` - Key string `json:"key" gorm:"type:varchar(256);not null;"` - Value string `json:"value" gorm:"type:varchar(256)"` - About string `json:"about" gorm:"type:longText"` + Key string `json:"key" gorm:"not null;"` + Value string `json:"value"` + About string `json:"about"` } func loadDBConn() (*gorm.DB, error) { diff --git a/core/app/model/backup.go b/core/app/model/backup.go index 2eb37a0aa..019a8fb61 100644 --- a/core/app/model/backup.go +++ b/core/app/model/backup.go @@ -2,15 +2,15 @@ package model type BackupAccount struct { BaseModel - Name string `gorm:"type:varchar(64);unique;not null" json:"name"` - Type string `gorm:"type:varchar(64);unique;not null" json:"type"` - Bucket string `gorm:"type:varchar(256)" json:"bucket"` - AccessKey string `gorm:"type:varchar(256)" json:"accessKey"` - Credential string `gorm:"type:varchar(256)" json:"credential"` - BackupPath string `gorm:"type:varchar(256)" json:"backupPath"` - Vars string `gorm:"type:longText" json:"vars"` + Name string `gorm:"unique;not null" json:"name"` + Type string `gorm:"unique;not null" json:"type"` + Bucket string `json:"bucket"` + AccessKey string `json:"accessKey"` + Credential string `json:"credential"` + BackupPath string `json:"backupPath"` + Vars string `json:"vars"` - RememberAuth bool `gorm:"type:varchar(64)" json:"rememberAuth"` - InUsed bool `gorm:"type:varchar(64)" json:"inUsed"` - EntryID uint `gorm:"type:varchar(64)" json:"entryID"` + RememberAuth bool `json:"rememberAuth"` + InUsed bool `json:"inUsed"` + EntryID uint `json:"entryID"` } diff --git a/core/app/model/logs.go b/core/app/model/logs.go index 4018f4322..490b6a48c 100644 --- a/core/app/model/logs.go +++ b/core/app/model/logs.go @@ -6,26 +6,25 @@ import ( type OperationLog struct { 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"` - Path string `gorm:"type:varchar(64)" json:"path"` - Method string `gorm:"type:varchar(64)" json:"method"` - UserAgent string `gorm:"type:varchar(256)" json:"userAgent"` + Latency time.Duration `json:"latency"` + Status string `json:"status"` + Message string `json:"message"` - Latency time.Duration `gorm:"type:varchar(64)" json:"latency"` - Status string `gorm:"type:varchar(64)" json:"status"` - Message string `gorm:"type:varchar(256)" json:"message"` - - DetailZH string `gorm:"type:varchar(256)" json:"detailZH"` - DetailEN string `gorm:"type:varchar(256)" json:"detailEN"` + DetailZH string `json:"detailZH"` + DetailEN string `json:"detailEN"` } type LoginLog struct { BaseModel - IP string `gorm:"type:varchar(64)" json:"ip"` - Address string `gorm:"type:varchar(64)" json:"address"` - Agent string `gorm:"type:varchar(256)" json:"agent"` - Status string `gorm:"type:varchar(64)" json:"status"` - Message string `gorm:"type:longText" json:"message"` + IP string `json:"ip"` + Address string `json:"address"` + Agent string `json:"agent"` + Status string `json:"status"` + Message string `json:"message"` } diff --git a/core/app/model/setting.go b/core/app/model/setting.go index e9791b79b..ded547895 100644 --- a/core/app/model/setting.go +++ b/core/app/model/setting.go @@ -2,7 +2,7 @@ package model type Setting struct { BaseModel - Key string `json:"key" gorm:"type:varchar(256);not null;"` - Value string `json:"value" gorm:"type:varchar(256)"` - About string `json:"about" gorm:"type:longText"` + Key string `json:"key" gorm:"not null;"` + Value string `json:"value"` + About string `json:"about"` }