com.github.yuweiguocn.library.greendao.MigrationHelper Java Examples

The following examples show how to use com.github.yuweiguocn.library.greendao.MigrationHelper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AppDbHelper.java    From v9porn with MIT License 6 votes vote down vote up
@Inject
AppDbHelper(MySQLiteOpenHelper helper) {
    //如果你想查看日志信息,请将DEBUG设置为true
    MigrationHelper.DEBUG = BuildConfig.DEBUG;
    Database db = helper.getWritableDb();
    this.mDaoSession = new DaoMaster(db).newSession();
    initCategory(Category.TYPE_91PORN, Category.CATEGORY_DEFAULT_91PORN_VALUE, Category.CATEGORY_DEFAULT_91PORN_NAME);
    initCategory(Category.TYPE_91PORN_FORUM, Category.CATEGORY_DEFAULT_91PORN_FORUM_VALUE, Category.CATEGORY_DEFAULT_91PORN_FORUM_NAME);
    initCategory(Category.TYPE_MEI_ZI_TU, Category.CATEGORY_DEFAULT_MEI_ZI_TU_VALUE, Category.CATEGORY_DEFAULT_MEI_ZI_TU_NAME);
    initCategory(Category.TYPE_PXG_AV, Category.CATEGORY_DEFAULT_PXG_AV_VALUE, Category.CATEGORY_DEFAULT_PXG_AV_NAME);
    initCategory(Category.TYPE_99_MM, Category.CATEGORY_DEFAULT_99_MM_VALUE, Category.CATEGORY_DEFAULT_99_MM_NAME);
    initCategory(Category.TYPE_HUA_BAN, null, Category.CATEGORY_DEFAULT_HUA_BAN_NAME);
    initCategory(Category.TYPE_AXGLE, Category.CATEGORY_DEFAULT_AXGLE_VALUE, Category.CATEGORY_DEFAULT_AXGLE_NAME);
    initCategory(Category.TYPE_DOU_BAN, Category.CATEGORY_DEFAULT_DOUBAN_MEIZI_VALUE, Category.CATEGORY_DEFAULT_DOUBAN_MEIZI_NAME);
    initCategory(Category.TYPE_KE_DOU_WO, Category.CATEGORY_DEFAULT_KE_DOU_WO_VALUE, Category.CATEGORY_DEFAULT_KE_DOU_WO_NAME);
}
 
Example #2
Source File: AppDbHelper.java    From v9porn with MIT License 5 votes vote down vote up
@Inject
AppDbHelper(MySQLiteOpenHelper helper) {
    //如果你想查看日志信息,请将DEBUG设置为true
    MigrationHelper.DEBUG = BuildConfig.DEBUG;
    Database db = helper.getWritableDb();
    this.mDaoSession = new DaoMaster(db).newSession();
    initCategory(Category.TYPE_91PORN, Category.CATEGORY_DEFAULT_91PORN_VALUE, Category.CATEGORY_DEFAULT_91PORN_NAME);
    initCategory(Category.TYPE_91PORN_FORUM, Category.CATEGORY_DEFAULT_91PORN_FORUM_VALUE, Category.CATEGORY_DEFAULT_91PORN_FORUM_NAME);
    initCategory(Category.TYPE_MEI_ZI_TU, Category.CATEGORY_DEFAULT_MEI_ZI_TU_VALUE, Category.CATEGORY_DEFAULT_MEI_ZI_TU_NAME);
    initCategory(Category.TYPE_PXG_AV, Category.CATEGORY_DEFAULT_PXG_AV_VALUE, Category.CATEGORY_DEFAULT_PXG_AV_NAME);
    initCategory(Category.TYPE_99_MM, Category.CATEGORY_DEFAULT_99_MM_VALUE, Category.CATEGORY_DEFAULT_99_MM_NAME);
    initCategory(Category.TYPE_HUA_BAN, null, Category.CATEGORY_DEFAULT_HUA_BAN_NAME);
    initCategory(Category.TYPE_AXGLE, Category.CATEGORY_DEFAULT_AXGLE_VALUE, Category.CATEGORY_DEFAULT_AXGLE_NAME);
}
 
Example #3
Source File: BaseApplication.java    From Android-IM with Apache License 2.0 5 votes vote down vote up
private void setupDatabase() {
    //是否开启调试
    MigrationHelper.DEBUG = true;
    QueryBuilder.LOG_SQL = true;
    QueryBuilder.LOG_VALUES = true;
    //数据库升级
    helper = new MySQLiteOpenHelper(mContext, "text");
    master = new DaoMaster(helper.getWritableDb());

}
 
Example #4
Source File: DatabaseUtils.java    From MiPushFramework with GNU General Public License v3.0 5 votes vote down vote up
public static void init (Context context) {
    if (daoSession != null) {
        return;
    }
    MigrationHelper.DEBUG = true;
    MySQLiteOpenHelper helper = new MySQLiteOpenHelper(context
            , "db",
            null);
    daoSession = new DaoMaster(helper.getWritableDatabase())
            .newSession();
}
 
Example #5
Source File: MySQLiteOpenHelper.java    From Android-IM with Apache License 2.0 4 votes vote down vote up
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    super.onUpgrade(db, oldVersion, newVersion);
    //设置需要升级的表
    MigrationHelper.migrate(db,ChatLogDao.class,UserDao.class,RequestListDao.class);
}