The @CeMigrationEntity
annotation is applied to entity classes to enable automatic generation of database migrations when the schema changes. This facilitates seamless evolution of the database without the need for manually defining migration scripts.
migrationVersion: Int
Specifies the migration version for the entity's table.
When the entity structure changes (e.g., fields are added or removed), this version number triggers the automatic generation of the appropriate migration.
kotlin
КопироватьРедактировать
@CeMigrationEntity(migrationVersion = 4)
@Entity
data class User(
@PrimaryKey val id: Int,
val name: String,
val email: String
)
This annotation replaces the deprecated @MigrationEntityCE
.
If you previously used @MigrationEntityCE
, please replace it with @CeMigrationEntity
to avoid compilation errors.