use of io.requery.android.sqlite.DatabaseSource in project requery by requery.
the class PeopleApplication method getData.
/**
* @return {@link EntityDataStore} single instance for the application.
* <p/>
* Note if you're using Dagger you can make this part of your application level module returning
* {@code @Provides @Singleton}.
*/
ReactiveEntityStore<Persistable> getData() {
if (dataStore == null) {
// override onUpgrade to handle migrating to a new version
DatabaseSource source = new DatabaseSource(this, Models.DEFAULT, 1);
if (BuildConfig.DEBUG) {
// use this in development mode to drop and recreate the tables on every upgrade
source.setTableCreationMode(TableCreationMode.DROP_CREATE);
}
Configuration configuration = source.getConfiguration();
dataStore = ReactiveSupport.toReactiveStore(new EntityDataStore<Persistable>(configuration));
}
return dataStore;
}
Aggregations