-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #373 from jogrimst/master
#327 Do not increase greenDAO schemaVersion if no database changes have been made
- Loading branch information
Showing
7 changed files
with
56 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
app/src/main/java/org/literacyapp/dao/CustomDaoMaster.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.literacyapp.dao; | ||
|
||
import android.content.Context; | ||
import android.database.sqlite.SQLiteDatabase; | ||
import android.util.Log; | ||
|
||
import org.greenrobot.greendao.database.Database; | ||
import org.literacyapp.contentprovider.dao.DaoMaster; | ||
|
||
public class CustomDaoMaster extends DaoMaster { | ||
|
||
public CustomDaoMaster(SQLiteDatabase db) { | ||
super(db); | ||
Log.i(getClass().getName(), "CustomDaoMaster"); | ||
} | ||
|
||
public static class DevOpenHelper extends OpenHelper { | ||
public DevOpenHelper(Context context, String name) { | ||
super(context, name); | ||
} | ||
|
||
public DevOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory) { | ||
super(context, name, factory); | ||
} | ||
|
||
@Override | ||
public void onUpgrade(Database db, int oldVersion, int newVersion) { | ||
Log.i(getClass().getName(), "Upgrading schema from version " + oldVersion + " to " + newVersion); | ||
|
||
if (oldVersion < 2000000) { | ||
dropAllTables(db, true); | ||
onCreate(db); | ||
} | ||
|
||
// if (oldVersion < ???) { | ||
// // Add new tables and/or columns automatically (include only the DAO classes that have been modified) | ||
// DbMigrationHelper.migrate(db, | ||
// AudioDao.class | ||
// ); | ||
// } | ||
|
||
// If tables and/or columns have been renamed, add custom script. | ||
// db.execSQL("..."); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ontentprovider/dao/DbMigrationHelper.java → ...rg/literacyapp/dao/DbMigrationHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 0 additions & 138 deletions
138
contentprovider/src/main/java/org/literacyapp/contentprovider/dao/CustomDaoMaster.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters