Skip to content

Commit 802930a

Browse files
committed
Fix "no such table" bug.
Thanks to a catch here for the solution: https://stackoverflow.com/questions/33031570/android-sugar-orm-no-such-table-exception
1 parent 7fb687e commit 802930a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/org/havenapp/main/HavenApp.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
import com.facebook.drawee.backends.pipeline.Fresco;
2626
import com.facebook.imagepipeline.core.ImagePipelineConfig;
2727
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig;
28+
import com.orm.SchemaGenerator;
2829
import com.orm.SugarContext;
30+
import com.orm.SugarDb;
2931

3032
import java.io.IOException;
3133

@@ -46,7 +48,10 @@ public class HavenApp extends MultiDexApplication {
4648
public void onCreate() {
4749
super.onCreate();
4850

49-
SugarContext.init(this);
51+
SugarContext.init(getApplicationContext());
52+
53+
SchemaGenerator schemaGenerator = new SchemaGenerator(this);
54+
schemaGenerator.createDatabase(new SugarDb(this).getDB());
5055

5156
mPrefs = new PreferenceManager(this);
5257

0 commit comments

Comments
 (0)