NitroSQLite
react-native-nitro-sqlite-drizzleFunctions

useMigrations

TypeScript

Source files: TypeScript

useMigrations<TSchema>(db, migrations): MigrationState

Run migrate on mount and when the database or migration bundle changes. Concurrent calls on the same connection are serialized, including Strict Mode effect replays. Results from earlier inputs or after unmount do not update state.

Type Parameters

TSchema

TSchema extends Record<string, unknown>

Tables and relations supplied to Drizzle.

Parameters

db

NitroSQLiteDatabase<TSchema>

Database returned by drizzle().

migrations

MigrationConfig

The migrations.js module that drizzle-kit generates.

Returns

MigrationState

success once the migrations finished, or the error they failed with.

On this page