get KQLite Migrations
Used when database upgrade or downgrade is required by comparing PRAGMA user_version and given version to KQLiteDatabase.
If a direct migration (e.g., from version 1 → 3) exists, it takes precedence over any step-by-step migrations (e.g., 1 → 2 → 3).
Each migration is executed within its own TransactionType.EXCLUSIVE transaction.
Returning null (default) disables migrations; if a migration is required and it KQLiteMigration is missing in given list, SQLiteException is thrown.
Example
override fun getKQLiteMigrations(): List<KQLiteMigration> {
return listOf(
MyMigrationV12(), // Upgrade 1 -> 2
MyMigrationV23(), // Upgrade 2 -> 3
MyMigrationV13(), // Direct upgrade 1 -> 3, ignores V12 and V23
MyMigrationV43(), // Downgrade 4 -> 3
)
}Content copied to clipboard
Return
A list of KQLiteMigration objects, or null if no migrations are defined.
Author
MOHAMMAD AZIM ANSARI
See also
Throws
If a migration is required but not found in the given list.