mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-30 20:52:21 -05:00
Move migration 19 before 17
Migration 17 depends on Account deserialization, so any migrations that touch the accounts table need to be applied beforehand. Re-writing the migration to work directly on the database would lead to a lot of code duplication, so it's not worth it at this time, but might become necessary later on to avoid dependency cycles.
This commit is contained in:
parent
8471fbd9b7
commit
c6e54e7e5a
@ -304,6 +304,12 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||||||
db.execSQL("ALTER TABLE " + Message.TABLENAME + " ADD COLUMN "
|
db.execSQL("ALTER TABLE " + Message.TABLENAME + " ADD COLUMN "
|
||||||
+ Message.CARBON + " INTEGER");
|
+ Message.CARBON + " INTEGER");
|
||||||
}
|
}
|
||||||
|
if (oldVersion < 19 && newVersion >= 19) {
|
||||||
|
db.execSQL("ALTER TABLE " + Account.TABLENAME + " ADD COLUMN "+ Account.DISPLAY_NAME+ " TEXT");
|
||||||
|
}
|
||||||
|
/* Any migrations that alter the Account table need to happen BEFORE this migration, as it
|
||||||
|
* depends on account de-serialization.
|
||||||
|
*/
|
||||||
if (oldVersion < 17 && newVersion >= 17) {
|
if (oldVersion < 17 && newVersion >= 17) {
|
||||||
List<Account> accounts = getAccounts(db);
|
List<Account> accounts = getAccounts(db);
|
||||||
for (Account account : accounts) {
|
for (Account account : accounts) {
|
||||||
@ -325,9 +331,6 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||||||
if (oldVersion < 18 && newVersion >= 18) {
|
if (oldVersion < 18 && newVersion >= 18) {
|
||||||
db.execSQL("ALTER TABLE " + Message.TABLENAME + " ADD COLUMN "+ Message.READ+ " NUMBER DEFAULT 1");
|
db.execSQL("ALTER TABLE " + Message.TABLENAME + " ADD COLUMN "+ Message.READ+ " NUMBER DEFAULT 1");
|
||||||
}
|
}
|
||||||
if (oldVersion < 19 && newVersion >= 19) {
|
|
||||||
db.execSQL("ALTER TABLE " + Account.TABLENAME + " ADD COLUMN "+ Account.DISPLAY_NAME+ " TEXT");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized DatabaseBackend getInstance(Context context) {
|
public static synchronized DatabaseBackend getInstance(Context context) {
|
||||||
|
Loading…
Reference in New Issue
Block a user