Table not created on some devices (Samsung, Nexus 5X)
DBFlow Version: 3.1.1 Issue Kind: Bug
Description: Hi, on my project I use DbFlow with Kotlin, DbFlow is cofiqured in a seperate module.
On some devices I get an exception:
Error Code : 1 (SQLITE_ERROR)
Caused By : SQL(query) error or missing database.
(no such table: ...)
It seems that the table is not created. If I clear app cache then it creates correctly. It might be a Marshmallow permission issue causes the issue but it does not happen for all devices.
Does anybody also have the issue?
Sounds like it could be caused by a migration issue as well. Keep in mind that dbflow will create tables that are missing then run migration scrips from current schema level to target schema level.
Make sure you don't . have any inappropriate DROP TABLE commands in any migrations
I have not seen this issue on any device Ive used. Is there any more information you can provide, such as how you initialize DBFlow and how you use it.
I inititialize DbFlow in Applicaiton
private fun initDBFlow() {
FlowManager.init(FlowConfig.Builder(this).build())
FlowManager.initModule(DataGeneratedDatabaseHolder::class.java)
}
also this does not work
private fun initDBFlow() {
FlowManager.init(FlowConfig.Builder(this).addDatabaseHolder(DataGeneratedDatabaseHolder.class).build());
}
in build.gradle of data-module i have this
kapt {
generateStubs = true
arguments {
arg("targetModuleName", "Data")
}
}
here is the table
@Table(name = "SectionViewDb", database = WeltNewsDatabase.class)
public class SectionViewDb extends BaseModel {
@PrimaryKey public String name;
@Column public int viewCount;
@Column public boolean noteHandled;
@Inject
public SectionViewDb() {
}
public SectionViewDb(final String name) {
this.name = name;
}
public SectionView toSectionView() {
return new SectionView(name, viewCount, noteHandled);
}
}
were you writing to external storage?
if so you would want to initialize DBFlow after that then if it cannot create DBs.