Migrations
How Migrations Work
Migration Classes
@Database(version = 2)
object AppDatabase {
@Migration(version = 2, database = AppDatabase::class, priority = 1)
class Migration2 : BaseMigration() {
override fun migrate(database: DatabaseWrapper) {
// run some code here
(update<Employee>()
set Employee_Table.status.eq("Invalid")
where Employee_Table.job.eq("Laid Off"))
.execute(database) // required to pass wrapper in migration
}
}
}Migration files
Prevent Recursive Access to the DB
Initial Database Setup
Provided Migration Classes
AlterTableMigration
Index Migrations
Update Table Migration
Last updated
Was this helpful?