|
|
@ -28,9 +28,8 @@ val appDb by lazy { |
|
|
|
RssStar::class, TxtTocRule::class, ReadRecord::class, HttpTTS::class, Cache::class, |
|
|
|
RssStar::class, TxtTocRule::class, ReadRecord::class, HttpTTS::class, Cache::class, |
|
|
|
RuleSub::class], |
|
|
|
RuleSub::class], |
|
|
|
autoMigrations = [ |
|
|
|
autoMigrations = [ |
|
|
|
AutoMigration(from = 1, to = 10), |
|
|
|
AutoMigration(from = 11, to = 12), |
|
|
|
AutoMigration(from = 12, to = 13), |
|
|
|
AutoMigration(from = 19, to = 20), |
|
|
|
AutoMigration(from = 19, to = 21), |
|
|
|
|
|
|
|
AutoMigration(from = 27, to = 29), |
|
|
|
AutoMigration(from = 27, to = 29), |
|
|
|
AutoMigration(from = 33, to = 35), |
|
|
|
AutoMigration(from = 33, to = 35), |
|
|
|
] |
|
|
|
] |
|
|
@ -63,14 +62,24 @@ abstract class AppDatabase : RoomDatabase() { |
|
|
|
Room.databaseBuilder(context, AppDatabase::class.java, DATABASE_NAME) |
|
|
|
Room.databaseBuilder(context, AppDatabase::class.java, DATABASE_NAME) |
|
|
|
.fallbackToDestructiveMigration() |
|
|
|
.fallbackToDestructiveMigration() |
|
|
|
.addMigrations( |
|
|
|
.addMigrations( |
|
|
|
migration_10_11, migration_13_14, |
|
|
|
migration_10_11, |
|
|
|
migration_14_15, migration_15_17, |
|
|
|
migration_12_13, |
|
|
|
migration_17_18, migration_18_19, |
|
|
|
migration_13_14, |
|
|
|
migration_21_22, migration_22_23, |
|
|
|
migration_14_15, |
|
|
|
migration_23_24, migration_24_25, |
|
|
|
migration_15_17, |
|
|
|
migration_25_26, migration_26_27, |
|
|
|
migration_17_18, |
|
|
|
migration_29_30, migration_30_31, |
|
|
|
migration_18_19, |
|
|
|
migration_31_32, migration_32_33 |
|
|
|
migration_20_21, |
|
|
|
|
|
|
|
migration_21_22, |
|
|
|
|
|
|
|
migration_22_23, |
|
|
|
|
|
|
|
migration_23_24, |
|
|
|
|
|
|
|
migration_24_25, |
|
|
|
|
|
|
|
migration_25_26, |
|
|
|
|
|
|
|
migration_26_27, |
|
|
|
|
|
|
|
migration_29_30, |
|
|
|
|
|
|
|
migration_30_31, |
|
|
|
|
|
|
|
migration_31_32, |
|
|
|
|
|
|
|
migration_32_33 |
|
|
|
) |
|
|
|
) |
|
|
|
.allowMainThreadQueries() |
|
|
|
.allowMainThreadQueries() |
|
|
|
.addCallback(dbCallback) |
|
|
|
.addCallback(dbCallback) |
|
|
@ -120,6 +129,12 @@ abstract class AppDatabase : RoomDatabase() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private val migration_12_13 = object : Migration(12, 13) { |
|
|
|
|
|
|
|
override fun migrate(database: SupportSQLiteDatabase) { |
|
|
|
|
|
|
|
database.execSQL("ALTER TABLE rssSources ADD articleStyle INTEGER NOT NULL DEFAULT 0 ") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private val migration_13_14 = object : Migration(13, 14) { |
|
|
|
private val migration_13_14 = object : Migration(13, 14) { |
|
|
|
override fun migrate(database: SupportSQLiteDatabase) { |
|
|
|
override fun migrate(database: SupportSQLiteDatabase) { |
|
|
|
database.execSQL( |
|
|
|
database.execSQL( |
|
|
@ -168,6 +183,12 @@ abstract class AppDatabase : RoomDatabase() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private val migration_20_21 = object : Migration(20, 21) { |
|
|
|
|
|
|
|
override fun migrate(database: SupportSQLiteDatabase) { |
|
|
|
|
|
|
|
database.execSQL("ALTER TABLE book_groups ADD show INTEGER NOT NULL DEFAULT 1") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private val migration_21_22 = object : Migration(21, 22) { |
|
|
|
private val migration_21_22 = object : Migration(21, 22) { |
|
|
|
override fun migrate(database: SupportSQLiteDatabase) { |
|
|
|
override fun migrate(database: SupportSQLiteDatabase) { |
|
|
|
database.execSQL( |
|
|
|
database.execSQL( |
|
|
|