1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

refactor: migrations structure

fix: cascade for alias user foreign key constraint
This commit is contained in:
Ferdinand Mütsch
2021-02-02 21:50:43 +01:00
parent 4f7cc3c57e
commit b6812ddc3a
13 changed files with 258 additions and 180 deletions

View File

@ -2,8 +2,8 @@ package models
type Alias struct {
ID uint `gorm:"primary_key"`
Type uint8 `gorm:"not null; index:idx_alias_type_key; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
User *User `json:"-" gorm:"not null"`
Type uint8 `gorm:"not null; index:idx_alias_type_key"`
User *User `json:"-" gorm:"not null; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
UserID string `gorm:"not null; index:idx_alias_user"`
Key string `gorm:"not null; index:idx_alias_type_key"`
Value string `gorm:"not null"`