14 lines
436 B
Go
14 lines
436 B
Go
package models
|
|
|
|
import "time"
|
|
|
|
type UserDevice struct {
|
|
UserID uint `gorm:"primaryKey;index;not null"`
|
|
DeviceGUID string `gorm:"primaryKey;size:64;index;not null"`
|
|
CreatedAt time.Time
|
|
|
|
// Optional FKs with cascade (you already have cascade constraints on both sides)
|
|
User User `gorm:"constraint:OnDelete:CASCADE;"`
|
|
Device Device `gorm:"constraint:OnDelete:CASCADE;foreignKey:DeviceGUID;references:GUID"`
|
|
}
|