[backend/database] Fix slow AddUserLastNoteAdd migration
This change ensures that the migration doesn't have to read every note in the database, but only up to one per known user.
This commit is contained in:
parent
4b5a9386c7
commit
65d6edf799
1 changed files with 1 additions and 1 deletions
|
@ -20,7 +20,7 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
|
||||||
type: "timestamp with time zone",
|
type: "timestamp with time zone",
|
||||||
nullable: true);
|
nullable: true);
|
||||||
|
|
||||||
migrationBuilder.Sql("""UPDATE "user" SET "lastNoteAt" = (SELECT note."createdAt" FROM "note" WHERE "note"."userId" = "user"."id" ORDER BY "note"."createdAt" DESC LIMIT 1);""");
|
migrationBuilder.Sql("""UPDATE "user" SET "lastNoteAt" = (SELECT note."createdAt" FROM "note" WHERE "note"."userId" = "user"."id" ORDER BY "note"."id" DESC LIMIT 1);""");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
Loading…
Add table
Reference in a new issue