Skip to content

Commit

Permalink
fix: Fix gorm migration
Browse files Browse the repository at this point in the history
  • Loading branch information
LyricTian committed Dec 4, 2023
1 parent 3a6c946 commit 405341f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions internal/mods/rbac/schema/user_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (

// User roles for RBAC
type UserRole struct {
ID string `json:"id" gorm:"size:20;primarykey"` // Unique ID
UserID string `json:"user_id" gorm:"size:20;index"` // From User.ID
RoleID string `json:"role_id" gorm:"size:20;index"` // From Role.ID
CreatedAt time.Time `json:"created_at" gorm:"index;"` // Create time
UpdatedAt time.Time `json:"updated_at" gorm:"index;"` // Update time
RoleName string `json:"role_name" gorm:"<-:false"` // From Role.Name
ID string `json:"id" gorm:"size:20;primarykey"` // Unique ID
UserID string `json:"user_id" gorm:"size:20;index"` // From User.ID
RoleID string `json:"role_id" gorm:"size:20;index"` // From Role.ID
CreatedAt time.Time `json:"created_at" gorm:"index;"` // Create time
UpdatedAt time.Time `json:"updated_at" gorm:"index;"` // Update time
RoleName string `json:"role_name" gorm:"<-:false;-:migration;"` // From Role.Name
}

func (a *UserRole) TableName() string {
Expand Down
22 changes: 11 additions & 11 deletions internal/mods/sys/schema/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import (

// Logger management
type Logger struct {
ID string `gorm:"size:20;primaryKey;" json:"id"` // Unique ID
Level string `gorm:"size:20;index;" json:"level"` // Log level
TraceID string `gorm:"size:64;index;" json:"trace_id"` // Trace ID
UserID string `gorm:"size:20;index;" json:"user_id"` // User ID
Tag string `gorm:"size:32;index;" json:"tag"` // Log tag
Message string `gorm:"size:1024;" json:"message"` // Log message
Stack string `gorm:"type:text;" json:"stack"` // Error stack
Data string `gorm:"type:text;" json:"data"` // Log data
CreatedAt time.Time `gorm:"index;" json:"created_at"` // Create time
LoginName string `json:"login_name" gorm:"<-:false"` // From User.Username
UserName string `json:"user_name" gorm:"<-:false"` // From User.Name
ID string `gorm:"size:20;primaryKey;" json:"id"` // Unique ID
Level string `gorm:"size:20;index;" json:"level"` // Log level
TraceID string `gorm:"size:64;index;" json:"trace_id"` // Trace ID
UserID string `gorm:"size:20;index;" json:"user_id"` // User ID
Tag string `gorm:"size:32;index;" json:"tag"` // Log tag
Message string `gorm:"size:1024;" json:"message"` // Log message
Stack string `gorm:"type:text;" json:"stack"` // Error stack
Data string `gorm:"type:text;" json:"data"` // Log data
CreatedAt time.Time `gorm:"index;" json:"created_at"` // Create time
LoginName string `json:"login_name" gorm:"<-:false;-:migration;"` // From User.Username
UserName string `json:"user_name" gorm:"<-:false;-:migration;"` // From User.Name
}

func (a *Logger) TableName() string {
Expand Down

0 comments on commit 405341f

Please sign in to comment.