fix: update TusLock to use a compound unique index to work with soft deletes
This commit is contained in:
parent
43c4590439
commit
b10798d71f
|
@ -14,11 +14,12 @@ var (
|
||||||
|
|
||||||
type TusLock struct {
|
type TusLock struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
LockId string `gorm:"uniqueIndex"`
|
LockId string `gorm:"index:idx_lock_id,unique"`
|
||||||
HolderPID int `gorm:"index"`
|
HolderPID int `gorm:"index"`
|
||||||
AcquiredAt time.Time
|
AcquiredAt time.Time
|
||||||
ExpiresAt 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 {
|
func (t *TusLock) TryLock(db *gorm.DB, ctx context.Context) error {
|
||||||
|
|
Loading…
Reference in New Issue