mirror of
https://github.com/juanfont/headscale.git
synced 2025-08-12 08:57:39 +00:00
Restore foreign keys and add constraints (#1562)
* fix #1482, restore foregin keys, add constraints * #1562, fix tests, fix formatting * #1562: fix tests * #1562: fix local run of test_integration
This commit is contained in:
@@ -108,20 +108,20 @@ type Node struct {
|
||||
// parts of headscale.
|
||||
GivenName string `gorm:"type:varchar(63);unique_index"`
|
||||
UserID uint
|
||||
User User `gorm:"foreignKey:UserID"`
|
||||
User User `gorm:"constraint:OnDelete:CASCADE;"`
|
||||
|
||||
RegisterMethod string
|
||||
|
||||
ForcedTags StringList
|
||||
|
||||
// TODO(kradalby): This seems like irrelevant information?
|
||||
AuthKeyID uint
|
||||
AuthKey *PreAuthKey
|
||||
AuthKeyID *uint `sql:"DEFAULT:NULL"`
|
||||
AuthKey *PreAuthKey `gorm:"constraint:OnDelete:SET NULL;"`
|
||||
|
||||
LastSeen *time.Time
|
||||
Expiry *time.Time
|
||||
|
||||
Routes []Route
|
||||
Routes []Route `gorm:"constraint:OnDelete:CASCADE;"`
|
||||
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
|
@@ -14,11 +14,11 @@ type PreAuthKey struct {
|
||||
ID uint64 `gorm:"primary_key"`
|
||||
Key string
|
||||
UserID uint
|
||||
User User
|
||||
User User `gorm:"constraint:OnDelete:CASCADE;"`
|
||||
Reusable bool
|
||||
Ephemeral bool `gorm:"default:false"`
|
||||
Used bool `gorm:"default:false"`
|
||||
ACLTags []PreAuthKeyACLTag
|
||||
Ephemeral bool `gorm:"default:false"`
|
||||
Used bool `gorm:"default:false"`
|
||||
ACLTags []PreAuthKeyACLTag `gorm:"constraint:OnDelete:CASCADE;"`
|
||||
|
||||
CreatedAt *time.Time
|
||||
Expiration *time.Time
|
||||
|
Reference in New Issue
Block a user