aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video/video-channel.ts2
-rw-r--r--server/models/video/video-playlist-element.ts3
-rw-r--r--server/models/video/video-playlist.ts4
3 files changed, 5 insertions, 4 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 112abf8cf..c077fb518 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -223,7 +223,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
223 223
224 @HasMany(() => VideoPlaylistModel, { 224 @HasMany(() => VideoPlaylistModel, {
225 foreignKey: { 225 foreignKey: {
226 allowNull: false 226 allowNull: true
227 }, 227 },
228 onDelete: 'cascade', 228 onDelete: 'cascade',
229 hooks: true 229 hooks: true
diff --git a/server/models/video/video-playlist-element.ts b/server/models/video/video-playlist-element.ts
index d76149d12..5530e0492 100644
--- a/server/models/video/video-playlist-element.ts
+++ b/server/models/video/video-playlist-element.ts
@@ -188,7 +188,8 @@ export class VideoPlaylistElementModel extends Model<VideoPlaylistElementModel>
188 [Sequelize.Op.lte]: endPosition 188 [Sequelize.Op.lte]: endPosition
189 } 189 }
190 }, 190 },
191 transaction 191 transaction,
192 validate: false // We use a literal to update the position
192 } 193 }
193 194
194 return VideoPlaylistElementModel.update({ position: Sequelize.literal(`${newPosition} + "position" - ${firstPosition}`) }, query) 195 return VideoPlaylistElementModel.update({ position: Sequelize.literal(`${newPosition} + "position" - ${firstPosition}`) }, query)
diff --git a/server/models/video/video-playlist.ts b/server/models/video/video-playlist.ts
index 93b8c2f58..397887ebf 100644
--- a/server/models/video/video-playlist.ts
+++ b/server/models/video/video-playlist.ts
@@ -197,7 +197,7 @@ export class VideoPlaylistModel extends Model<VideoPlaylistModel> {
197 197
198 @BelongsTo(() => VideoChannelModel, { 198 @BelongsTo(() => VideoChannelModel, {
199 foreignKey: { 199 foreignKey: {
200 allowNull: false 200 allowNull: true
201 }, 201 },
202 onDelete: 'CASCADE' 202 onDelete: 'CASCADE'
203 }) 203 })
@@ -351,7 +351,7 @@ export class VideoPlaylistModel extends Model<VideoPlaylistModel> {
351 updatedAt: this.updatedAt, 351 updatedAt: this.updatedAt,
352 352
353 ownerAccount: this.OwnerAccount.toFormattedSummaryJSON(), 353 ownerAccount: this.OwnerAccount.toFormattedSummaryJSON(),
354 videoChannel: this.VideoChannel.toFormattedSummaryJSON() 354 videoChannel: this.VideoChannel ? this.VideoChannel.toFormattedSummaryJSON() : null
355 } 355 }
356 } 356 }
357 357