fix: backfill postgres upload result defaults
This commit is contained in:
@@ -490,13 +490,13 @@ public sealed class SqliteToPostgresMigrationService
|
|||||||
SetParameter(command, "@DanmakuMessageCount", reader.GetInt32(i++));
|
SetParameter(command, "@DanmakuMessageCount", reader.GetInt32(i++));
|
||||||
SetParameter(command, "@FinalStatus", reader.GetInt32(i++));
|
SetParameter(command, "@FinalStatus", reader.GetInt32(i++));
|
||||||
SetParameter(command, "@ErrorMessage", GetNullableString(reader, 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, "@LastUploadProvider", GetNullableString(reader, i++));
|
||||||
SetParameter(command, "@RemoteVideoPath", GetNullableString(reader, i++));
|
SetParameter(command, "@RemoteVideoPath", GetNullableString(reader, i++));
|
||||||
SetParameter(command, "@RemoteDanmakuPath", GetNullableString(reader, i++));
|
SetParameter(command, "@RemoteDanmakuPath", GetNullableString(reader, i++));
|
||||||
SetParameter(command, "@LastUploadedAt", GetNullableDateTimeOffset(reader, i++));
|
SetParameter(command, "@LastUploadedAt", GetNullableDateTimeOffset(reader, i++));
|
||||||
SetParameter(command, "@UploadErrorMessage", GetNullableString(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++));
|
SetParameter(command, "@CreatedAt", GetDateTimeOffset(reader, i++));
|
||||||
},
|
},
|
||||||
cancellationToken);
|
cancellationToken);
|
||||||
|
|||||||
@@ -852,9 +852,9 @@ public sealed partial class FfmpegService
|
|||||||
// RecordTaskId unique constraint races between scoped DbContext instances.
|
// RecordTaskId unique constraint races between scoped DbContext instances.
|
||||||
await dbContext.Database.ExecuteSqlInterpolatedAsync($"""
|
await dbContext.Database.ExecuteSqlInterpolatedAsync($"""
|
||||||
INSERT INTO "RecordResults"
|
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
|
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
|
ON CONFLICT("RecordTaskId") DO UPDATE SET
|
||||||
"FilePath" = excluded."FilePath",
|
"FilePath" = excluded."FilePath",
|
||||||
"FileSizeBytes" = excluded."FileSizeBytes",
|
"FileSizeBytes" = excluded."FileSizeBytes",
|
||||||
@@ -862,7 +862,9 @@ public sealed partial class FfmpegService
|
|||||||
"DanmakuFilePath" = excluded."DanmakuFilePath",
|
"DanmakuFilePath" = excluded."DanmakuFilePath",
|
||||||
"DanmakuMessageCount" = excluded."DanmakuMessageCount",
|
"DanmakuMessageCount" = excluded."DanmakuMessageCount",
|
||||||
"FinalStatus" = excluded."FinalStatus",
|
"FinalStatus" = excluded."FinalStatus",
|
||||||
"ErrorMessage" = excluded."ErrorMessage";
|
"ErrorMessage" = excluded."ErrorMessage",
|
||||||
|
"UploadStatus" = COALESCE("RecordResults"."UploadStatus", excluded."UploadStatus"),
|
||||||
|
"DeletedLocalFilesAfterUpload" = COALESCE("RecordResults"."DeletedLocalFilesAfterUpload", excluded."DeletedLocalFilesAfterUpload");
|
||||||
""", cancellationToken);
|
""", cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user