diff --git a/src/LiveRecorder.Infrastructure/Persistence/SqliteToPostgresMigrationService.cs b/src/LiveRecorder.Infrastructure/Persistence/SqliteToPostgresMigrationService.cs index 488d428..4b9839a 100644 --- a/src/LiveRecorder.Infrastructure/Persistence/SqliteToPostgresMigrationService.cs +++ b/src/LiveRecorder.Infrastructure/Persistence/SqliteToPostgresMigrationService.cs @@ -490,13 +490,13 @@ public sealed class SqliteToPostgresMigrationService SetParameter(command, "@DanmakuMessageCount", reader.GetInt32(i++)); SetParameter(command, "@FinalStatus", reader.GetInt32(i++)); SetParameter(command, "@ErrorMessage", GetNullableString(reader, i++)); - SetParameter(command, "@UploadStatus", reader.GetInt32(i++)); + SetParameter(command, "@UploadStatus", GetNullableInt32(reader, i++) ?? 0); SetParameter(command, "@LastUploadProvider", GetNullableString(reader, i++)); SetParameter(command, "@RemoteVideoPath", GetNullableString(reader, i++)); SetParameter(command, "@RemoteDanmakuPath", GetNullableString(reader, i++)); SetParameter(command, "@LastUploadedAt", GetNullableDateTimeOffset(reader, i++)); SetParameter(command, "@UploadErrorMessage", GetNullableString(reader, i++)); - SetParameter(command, "@DeletedLocalFilesAfterUpload", GetBoolean(reader, i++)); + SetParameter(command, "@DeletedLocalFilesAfterUpload", GetNullableBoolean(reader, i++) ?? false); SetParameter(command, "@CreatedAt", GetDateTimeOffset(reader, i++)); }, cancellationToken); diff --git a/src/LiveRecorder.Infrastructure/Services/FfmpegService.Utils.cs b/src/LiveRecorder.Infrastructure/Services/FfmpegService.Utils.cs index b7bd0c0..ac2f635 100644 --- a/src/LiveRecorder.Infrastructure/Services/FfmpegService.Utils.cs +++ b/src/LiveRecorder.Infrastructure/Services/FfmpegService.Utils.cs @@ -852,9 +852,9 @@ public sealed partial class FfmpegService // RecordTaskId unique constraint races between scoped DbContext instances. await dbContext.Database.ExecuteSqlInterpolatedAsync($""" INSERT INTO "RecordResults" - ("Id", "RecordTaskId", "FilePath", "FileSizeBytes", "DurationSeconds", "DanmakuFilePath", "DanmakuMessageCount", "FinalStatus", "ErrorMessage", "CreatedAt") + ("Id", "RecordTaskId", "FilePath", "FileSizeBytes", "DurationSeconds", "DanmakuFilePath", "DanmakuMessageCount", "FinalStatus", "ErrorMessage", "UploadStatus", "DeletedLocalFilesAfterUpload", "CreatedAt") VALUES - ({resultId}, {recordTask.Id}, {effectiveOutputPath}, {fileSize}, {durationSeconds}, {danmakuFilePath}, {normalizedDanmakuCount}, {finalStatus}, {recordTask.ErrorMessage}, {endedAt}) + ({resultId}, {recordTask.Id}, {effectiveOutputPath}, {fileSize}, {durationSeconds}, {danmakuFilePath}, {normalizedDanmakuCount}, {finalStatus}, {recordTask.ErrorMessage}, {(int)RecordArtifactUploadStatus.NotUploaded}, {false}, {endedAt}) ON CONFLICT("RecordTaskId") DO UPDATE SET "FilePath" = excluded."FilePath", "FileSizeBytes" = excluded."FileSizeBytes", @@ -862,7 +862,9 @@ public sealed partial class FfmpegService "DanmakuFilePath" = excluded."DanmakuFilePath", "DanmakuMessageCount" = excluded."DanmakuMessageCount", "FinalStatus" = excluded."FinalStatus", - "ErrorMessage" = excluded."ErrorMessage"; + "ErrorMessage" = excluded."ErrorMessage", + "UploadStatus" = COALESCE("RecordResults"."UploadStatus", excluded."UploadStatus"), + "DeletedLocalFilesAfterUpload" = COALESCE("RecordResults"."DeletedLocalFilesAfterUpload", excluded."DeletedLocalFilesAfterUpload"); """, cancellationToken); }