[backend/database] Prevent alt text migration from printing the info message twice

This commit is contained in:
Laura Hausmann 2024-10-09 18:39:40 +02:00
parent 8998cd2874
commit 3274259f12
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -13,14 +13,15 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
Console.WriteLine("Indexing drive file alt text, please hang tight!");
Console.WriteLine("This may take a long time (15-30 minutes), especially if your database is unusually large or you're running low end hardware.");
migrationBuilder.AddColumn<string>( migrationBuilder.AddColumn<string>(
name: "combinedAltText", name: "combinedAltText",
table: "note", table: "note",
type: "text", type: "text",
nullable: true); nullable: true);
Console.WriteLine("Indexing drive file alt text, please hang tight!");
Console.WriteLine("This may take a long time (15-30 minutes), especially if your database is unusually large or you're running low end hardware.");
migrationBuilder.Sql("""UPDATE note SET "combinedAltText"=(SELECT string_agg(comment, ' ') FROM drive_file WHERE id = ANY ("fileIds")) WHERE "fileIds" != '{}';"""); migrationBuilder.Sql("""UPDATE note SET "combinedAltText"=(SELECT string_agg(comment, ' ') FROM drive_file WHERE id = ANY ("fileIds")) WHERE "fileIds" != '{}';""");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(