From bb7e5605d15a2e58791b08101a77fe3437c111a5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 31 Mar 2023 13:28:41 +0200 Subject: [PATCH] Use hook inside the transaction To prevent serialization issue --- server/models/video/video-live.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/models/video/video-live.ts b/server/models/video/video-live.ts index 290e1dda7..1acf9cbf3 100644 --- a/server/models/video/video-live.ts +++ b/server/models/video/video-live.ts @@ -1,6 +1,7 @@ +import { Transaction } from 'sequelize' import { - BeforeDestroy, AllowNull, + BeforeDestroy, BelongsTo, Column, CreatedAt, @@ -100,11 +101,12 @@ export class VideoLiveModel extends Model ReplaySetting: VideoLiveReplaySettingModel @BeforeDestroy - static deleteReplaySetting (instance: VideoLiveModel) { + static deleteReplaySetting (instance: VideoLiveModel, options: { transaction: Transaction }) { return VideoLiveReplaySettingModel.destroy({ where: { id: instance.replaySettingId - } + }, + transaction: options.transaction }) } -- 2.41.0