migrate

abstract fun migrate(database: KQLiteDatabase)

Executes the migration logic.

This method is called when the database needs to be upgraded or downgraded from fromVersion to toVersion. Implementations should contain the necessary DSL operations to modify the database schema and/or data.

The entire migration process is wrapped in an EXCLUSIVE transaction, ensuring that the migration is atomic. If an exception is thrown, the transaction will be rolled back, leaving the database in its original state before the migration began.

Author

MOHAMMAD AZIM ANSARI

Parameters

database

The KQLiteDatabase instance to be migrated. Use this object to get KQLiteSchema via KQLiteDatabase.schema and KQLitePragma via KQLiteDatabase.pragma.

See also

Throws

if an error occurs during the migration after ROLLBACK.