fix(rivetkit): wrap onMigrate in savepoints#4960
Conversation
Review: fix(rivetkit): wrap onMigrate in savepointsOverviewThis PR replaces the dead IssuesDuplicate The function is copy-pasted verbatim into both Original error lost when ROLLBACK itself fails In the catch block in both files, if } catch (error) {
try {
await client.execute("ROLLBACK TO SAVEPOINT __rivet_on_migrate");
} catch {
// rollback failed; original error is still re-thrown below
} finally {
await client.execute("RELEASE SAVEPOINT __rivet_on_migrate");
}
throw error;
}Missing Drizzle test coverage
Observations (no action required)
SummaryThe core logic is correct and the removal of the defunct |
e1be3d6 to
f8261ca
Compare
021c18f to
c4c18dc
Compare
c4c18dc to
627fd20
Compare
f8261ca to
4bec251
Compare

Stack Context
This PR updates RivetKit SQLite migration handling.
What?
onMigratework in a SQLite savepoint.onMigratethrows.writeModeAPI from active SQLite surfaces and examples.onMigrateis atomic because it runs inside a savepoint.Why?
writeModeno longer routes anything specially, soonMigratewas not atomic by default. A savepoint gives migrations transaction semantics without using a top-levelBEGIN, which keeps the wrapper nestable with SQLite's transaction model.Verification
pnpm run check-typespnpm vitest run src/common/database/mod.test.ts src/common/database/native-database.test.tsgit diff --check