diff --git a/app/models/cron.go b/app/models/cron.go index 1a603fe4..859e0e26 100644 --- a/app/models/cron.go +++ b/app/models/cron.go @@ -1,15 +1,17 @@ package models import ( - "github.com/goravel/framework/database/orm" + "github.com/goravel/framework/support/carbon" ) type Cron struct { - orm.Model - Name string `gorm:"not null;unique"` - Status bool `gorm:"not null;default:false"` - Type string `gorm:"not null"` - Time string `gorm:"not null"` - Shell string `gorm:"default:''"` - Log string `gorm:"default:''"` + ID uint `gorm:"primaryKey" json:"id"` + Name string `gorm:"not null;unique" json:"name"` + Status bool `gorm:"not null;default:false" json:"status"` + Type string `gorm:"not null" json:"type"` + Time string `gorm:"not null" json:"time"` + Shell string `gorm:"default:''" json:"shell"` + Log string `gorm:"default:''" json:"log"` + CreatedAt carbon.DateTime `gorm:"autoCreateTime;column:created_at" json:"created_at"` + UpdatedAt carbon.DateTime `gorm:"autoUpdateTime;column:updated_at" json:"updated_at"` } diff --git a/app/models/database.go b/app/models/database.go index f8ef16d6..e4176f14 100644 --- a/app/models/database.go +++ b/app/models/database.go @@ -1,16 +1,16 @@ package models -import ( - "github.com/goravel/framework/database/orm" -) +import "github.com/goravel/framework/support/carbon" type Database struct { - orm.Model - Name string `gorm:"unique;not null"` - Type string `gorm:"not null;index"` - Host string `gorm:"not null"` - Port int `gorm:"not null"` - Username string `gorm:"not null"` - Password string `gorm:"default:''"` - Remark string `gorm:"default:''"` + ID uint `gorm:"primaryKey" json:"id"` + Name string `gorm:"unique;not null" json:"name"` + Type string `gorm:"not null;index" json:"type"` + Host string `gorm:"not null" json:"host"` + Port int `gorm:"not null" json:"port"` + Username string `gorm:"not null" json:"username"` + Password string `gorm:"default:''" json:"password"` + Remark string `gorm:"default:''" json:"remark"` + CreatedAt carbon.DateTime `gorm:"autoCreateTime;column:created_at" json:"created_at"` + UpdatedAt carbon.DateTime `gorm:"autoUpdateTime;column:updated_at" json:"updated_at"` } diff --git a/app/models/monitor.go b/app/models/monitor.go index 79aa1aff..bcc6da23 100644 --- a/app/models/monitor.go +++ b/app/models/monitor.go @@ -1,12 +1,13 @@ package models import ( + "github.com/goravel/framework/support/carbon" "panel/packages/helpers" - - "github.com/goravel/framework/database/orm" ) type Monitor struct { - orm.Model - Info helpers.MonitoringInfo `gorm:"type:json;serializer:json"` + ID uint `gorm:"primaryKey" json:"id"` + Info helpers.MonitoringInfo `gorm:"type:json;serializer:json" json:"info"` + CreatedAt carbon.DateTime `gorm:"autoCreateTime;column:created_at" json:"created_at"` + UpdatedAt carbon.DateTime `gorm:"autoUpdateTime;column:updated_at" json:"updated_at"` } diff --git a/app/models/plugin.go b/app/models/plugin.go index acee0b27..f4177319 100644 --- a/app/models/plugin.go +++ b/app/models/plugin.go @@ -1,13 +1,13 @@ package models -import ( - "github.com/goravel/framework/database/orm" -) +import "github.com/goravel/framework/support/carbon" type Plugin struct { - orm.Model - Slug string `gorm:"unique;not null"` - Version string `gorm:"not null"` - Show bool `gorm:"default:false;not null"` - ShowOrder int `gorm:"default:0;not null"` + ID uint `gorm:"primaryKey" json:"id"` + Slug string `gorm:"unique;not null" json:"slug"` + Version string `gorm:"not null" json:"version"` + Show bool `gorm:"default:false;not null" json:"show"` + ShowOrder int `gorm:"default:0;not null" json:"show_order"` + CreatedAt carbon.DateTime `gorm:"autoCreateTime;column:created_at" json:"created_at"` + UpdatedAt carbon.DateTime `gorm:"autoUpdateTime;column:updated_at" json:"updated_at"` } diff --git a/app/models/setting.go b/app/models/setting.go index 2c310a4b..31f06550 100644 --- a/app/models/setting.go +++ b/app/models/setting.go @@ -1,11 +1,11 @@ package models -import ( - "github.com/goravel/framework/database/orm" -) +import "github.com/goravel/framework/support/carbon" type Setting struct { - orm.Model - Key string `gorm:"unique;not null"` - Value string `gorm:"default:''"` + ID uint `gorm:"primaryKey" json:"id"` + Key string `gorm:"unique;not null" json:"key"` + Value string `gorm:"default:''" json:"value"` + CreatedAt carbon.DateTime `gorm:"autoCreateTime;column:created_at" json:"created_at"` + UpdatedAt carbon.DateTime `gorm:"autoUpdateTime;column:updated_at" json:"updated_at"` } diff --git a/app/models/task.go b/app/models/task.go index 9c798f82..860d31e9 100644 --- a/app/models/task.go +++ b/app/models/task.go @@ -1,7 +1,7 @@ package models import ( - "github.com/goravel/framework/database/orm" + "github.com/goravel/framework/support/carbon" ) const ( @@ -12,9 +12,11 @@ const ( ) type Task struct { - orm.Model - Name string `gorm:"not null"` - Status string `gorm:"not null;default:'waiting'"` - Shell string `gorm:"default:''"` - Log string `gorm:"default:''"` + ID uint `gorm:"primaryKey" json:"id"` + Name string `gorm:"not null" json:"name"` + Status string `gorm:"not null;default:'waiting'" json:"status"` + Shell string `gorm:"default:''" json:"shell"` + Log string `gorm:"default:''" json:"log"` + CreatedAt carbon.DateTime `gorm:"autoCreateTime;column:created_at" json:"created_at"` + UpdatedAt carbon.DateTime `gorm:"autoUpdateTime;column:updated_at" json:"updated_at"` } diff --git a/app/models/user.go b/app/models/user.go index 6e3663c1..c93a83a0 100644 --- a/app/models/user.go +++ b/app/models/user.go @@ -1,12 +1,12 @@ package models -import ( - "github.com/goravel/framework/database/orm" -) +import "github.com/goravel/framework/support/carbon" type User struct { - orm.Model - Username string `gorm:"unique;not null"` - Password string `gorm:"not null"` - Email string `gorm:"default:''"` + ID uint `gorm:"primaryKey" json:"id"` + Username string `gorm:"unique;not null" json:"username"` + Password string `gorm:"not null" json:"password"` + Email string `gorm:"default:''" json:"email"` + CreatedAt carbon.DateTime `gorm:"autoCreateTime;column:created_at" json:"created_at"` + UpdatedAt carbon.DateTime `gorm:"autoUpdateTime;column:updated_at" json:"updated_at"` } diff --git a/app/models/website.go b/app/models/website.go index ded74bf0..55b23338 100644 --- a/app/models/website.go +++ b/app/models/website.go @@ -1,15 +1,17 @@ package models import ( - "github.com/goravel/framework/database/orm" + "github.com/goravel/framework/support/carbon" ) type Website struct { - orm.Model - Name string `gorm:"unique;not null"` - Status bool `gorm:"default:true;not null;index"` - Path string `gorm:"not null"` - Php int `gorm:"default:0;not null;index"` - Ssl bool `gorm:"default:false;not null;index"` - Remark string `gorm:"default:''"` + ID uint `gorm:"primaryKey" json:"id"` + Name string `gorm:"unique;not null" json:"name"` + Status bool `gorm:"default:true;not null;index" json:"status"` + Path string `gorm:"not null" json:"path"` + Php int `gorm:"default:0;not null;index" json:"php"` + Ssl bool `gorm:"default:false;not null;index" json:"ssl"` + Remark string `gorm:"default:''" json:"remark"` + CreatedAt carbon.DateTime `gorm:"autoCreateTime;column:created_at" json:"created_at"` + UpdatedAt carbon.DateTime `gorm:"autoUpdateTime;column:updated_at" json:"updated_at"` }