Reputation: 703
I am creating a table using sugar ORM but reciving error of no such table. Even after updating Version to higher value in Android Manifest.
public class CachedVidcodes extends SugarRecord {
private String vidcodeId;
private String vidcodedownloadedPath;
public CachedVidcodes(){
}
public CachedVidcodes(String vidcodeId, String vidcodedownloadedPath){
this.vidcodeId = vidcodeId;
this.vidcodedownloadedPath = vidcodedownloadedPath;
}
public String getVidcodeId() {
return vidcodeId;
}
public void setVidcodeId(String vidcodeId) {
this.vidcodeId = vidcodeId;
}
public String getVidcodedownloadedPath() {
return vidcodedownloadedPath;
}
public void setVidcodedownloadedPath(String vidcodedownloadedPath) {
this.vidcodedownloadedPath = vidcodedownloadedPath;
}
}
Android Manifest Details are as follow
<meta-data
android:name="DATABASE"
android:value="vd.db" />
<meta-data
android:name="VERSION"
android:value="2" />
<meta-data
android:name="QUERY_LOG"
android:value="true" />
<meta-data
android:name="DOMAIN_PACKAGE_NAME"
android:value="com.vf.vde.ormclasses" />
Upvotes: 1
Views: 1645
Reputation: 7919
I solved my problem with increasing the number of DB_VERSION
in AndroidManifest so you can :
<meta-data android:name="VERSION" android:value="2" />
and change it forexample to 3:
<meta-data android:name="VERSION" android:value="3" />
Upvotes: 0
Reputation: 703
This problem can be solved by creating an empty "migration script file with new version".
This can be simply done by following :
1. Create your new Sugar record class.
2. In Android manifest file just increase the DB version.
3. Add an empty migration script file named after the new DB version, placed under assets/sugar_upgrades. (example. 2.sql).
By doing this, it creates the new table without dropping/creating my old tables.
Upvotes: 1