fix: update TusLock to use a compound unique index to work with soft deletes

This commit is contained in:
Derrick Hammer 2024-01-20 11:36:12 -05:00
parent 43c4590439
commit b10798d71f
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 2 deletions

View File

@ -14,11 +14,12 @@ var (
type TusLock struct {
gorm.Model
LockId string `gorm:"uniqueIndex"`
LockId string `gorm:"index:idx_lock_id,unique"`
HolderPID int `gorm:"index"`
AcquiredAt time.Time
ExpiresAt time.Time
ReleaseRequested bool `gorm:"default:false"`
ReleaseRequested bool
DeletedAt gorm.DeletedAt `gorm:"index:idx_lock_id,unique"`
}
func (t *TusLock) TryLock(db *gorm.DB, ctx context.Context) error {