Use hook inside the transaction
To prevent serialization issue
This commit is contained in:
parent
05a60d8599
commit
bb7e5605d1
1 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
|
import { Transaction } from 'sequelize'
|
||||||
import {
|
import {
|
||||||
BeforeDestroy,
|
|
||||||
AllowNull,
|
AllowNull,
|
||||||
|
BeforeDestroy,
|
||||||
BelongsTo,
|
BelongsTo,
|
||||||
Column,
|
Column,
|
||||||
CreatedAt,
|
CreatedAt,
|
||||||
|
@ -100,11 +101,12 @@ export class VideoLiveModel extends Model<Partial<AttributesOnly<VideoLiveModel>
|
||||||
ReplaySetting: VideoLiveReplaySettingModel
|
ReplaySetting: VideoLiveReplaySettingModel
|
||||||
|
|
||||||
@BeforeDestroy
|
@BeforeDestroy
|
||||||
static deleteReplaySetting (instance: VideoLiveModel) {
|
static deleteReplaySetting (instance: VideoLiveModel, options: { transaction: Transaction }) {
|
||||||
return VideoLiveReplaySettingModel.destroy({
|
return VideoLiveReplaySettingModel.destroy({
|
||||||
where: {
|
where: {
|
||||||
id: instance.replaySettingId
|
id: instance.replaySettingId
|
||||||
}
|
},
|
||||||
|
transaction: options.transaction
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue