-
Notifications
You must be signed in to change notification settings - Fork 16
@BindDataSourceUpdateTask
xcesco edited this page May 2, 2018
·
1 revision
Database schema migrations are managed by migration tasks that are defined by SQLiteUpdateTask
derived classes. You can define an update tasks set:
- By code, typically in
Application#onCreate
method. - By annotation, in @BindDataSourceOptions annotation used in a data source definition.
@BindDataSourceOptions(updateTasks = {
@BindDataSourceUpdateTask(version = 2, task = PersonUpdateTask.class)
})
@BindDataSource(daoSet = { DaoPerson.class }, fileName = "app.db")
public interface AppDataSource {
}
@BindDataSourceUpdateTask(version = 2, task = PersonUpdateTask.class)
will use the class PersonUpdateTask
to migrate from version 1 to version 2. Migration tasks support database migration from version n to version n+1. No gap versions are allowed. For this reason, you need only to specify target version, since star version is always defined as target version - 1
.
public class PersonUpdateTask implements SQLiteUpdateTask {
@Override
public void execute(SQLiteDatabase database, int previousVersion, int currentVersion) {
...
}
}
- Introduction
- Goals & Features
- Kotlin
- Immutable or Mutable Pojo
- Annotation Processor Args
- Credits
- Articles
- Benchmarks
- Setup
- Tutorial
- Usage
- Dependencies and inspirations
- Stackoverflow
- Documentation
- SQL logging
- Data source options
- Indices
- SQL Type adapter
- Global SQL Type adapter
- Constraints
- Live data: welcome Architectural components!!
- Paged Live data
- Dynamic parts
- Transactional and batch operations
- Async Transactional and batch operations
- Global transaction
- Support for immutable POJO
- Generate Content provider
- Generate Database schema generation
- Database migration
- BindSqlColumn
- BindContentProvider
- BindContentProviderEntry
- BindContentProviderPath
- BindDao
- BindDaoMany2Many
- BindDataSource
- BindDataSourceOptions
- BindDataSourceUpdateTask
- BindIndex
- BindSqlRelation
- BindSqlAdapter
- BindSqlChildSelect
- BindSqlDelete
- BindSqlDynamicOrderBy
- BindSqlDynamicWhere
- BindSqlDynamicWhereParams
- BindSqlInsert
- BindSqlPageSize
- BindSqlParam
- BindSqlSelect
- BindSqlUpdate
- BindSqlType
- BindSqlTransaction