Function: switchVersion()

switchVersion(args): Promise<void>

Switches the current Version to the given Version.

The Version must already exist before calling this function.

Parameters

args

lix

Lix

to

Pick<Version, "id">

Returns

Promise<void>

Examples

await switchVersion({ lix, to: otherVersion });

Switching to a newly created version.

await lix.db.transaction().execute(async (trx) => {
   const newVersion = await createVersion({ lix: { db: trx }, changeSet: { id: currentVersion.change_set_id } });
   await switchVersion({ lix: { db: trx }, to: newVersion });
});