@@ -445,22 +445,22 @@ await migrations.cancel(ctx, "myNewMutation");
445445## Running migrations synchronously
446446
447447If you want to run a migration synchronously from a test or action, you can use
448- ` runSynchronously ` . Note that if the action crashes or is canceled, it will not
448+ ` runToCompletion ` . Note that if the action crashes or is canceled, it will not
449449continue migrating in the background.
450450
451451From an action:
452452
453453``` ts
454454import { components , internal } from " ./_generated/api" ;
455455import { internalAction } from " ./_generated/server" ;
456- import { runSynchronously } from " @convex-dev/migrations" ;
456+ import { runToCompletion } from " @convex-dev/migrations" ;
457457
458458export const myAction = internalAction ({
459459 args: {},
460460 handler : async (ctx ) => {
461461 // ...
462462 const toRun = internal .example .setDefaultValue ;
463- await runSynchronously (ctx , components .migrations , toRun );
463+ await runToCompletion (ctx , components .migrations , toRun );
464464 },
465465});
466466```
@@ -471,7 +471,7 @@ In a test:
471471import { test } from " vitest" ;
472472import { convexTest } from " convex-test" ;
473473import component from " @convex-dev/migrations/test" ;
474- import { runSynchronously } from " @convex-dev/migrations" ;
474+ import { runToCompletion } from " @convex-dev/migrations" ;
475475import { components , internal } from " ./_generated/api" ;
476476import schema from " ./schema" ;
477477
@@ -486,7 +486,7 @@ test("test setDefaultValue migration", async () => {
486486
487487 // Run the migration to completion
488488 const migrationToTest = internal .example .setDefaultValue ;
489- await runSynchronously (ctx , components .migrations , migrationToTest );
489+ await runToCompletion (ctx , components .migrations , migrationToTest );
490490
491491 // Assert that the migration was successful by checking the data
492492 const docs = await ctx .db .query (" myTable" ).collect ();
0 commit comments