db: upgrade to 21, add markdownMode column
This commit is contained in:
parent
793c21eb85
commit
74ea67627c
|
@ -72,7 +72,7 @@ public class TuskyApplication extends Application implements HasAndroidInjector
|
|||
AppDatabase.MIGRATION_11_12, AppDatabase.MIGRATION_12_13, AppDatabase.MIGRATION_10_13,
|
||||
AppDatabase.MIGRATION_13_14, AppDatabase.MIGRATION_14_15, AppDatabase.MIGRATION_15_16,
|
||||
AppDatabase.MIGRATION_16_17, AppDatabase.MIGRATION_17_18, AppDatabase.MIGRATION_18_19,
|
||||
AppDatabase.MIGRATION_19_20)
|
||||
AppDatabase.MIGRATION_19_20, AppDatabase.MIGRATION_20_21)
|
||||
.build();
|
||||
accountManager = new AccountManager(appDatabase);
|
||||
serviceLocator = new ServiceLocator() {
|
||||
|
|
|
@ -30,7 +30,7 @@ import androidx.annotation.NonNull;
|
|||
|
||||
@Database(entities = {TootEntity.class, AccountEntity.class, InstanceEntity.class, TimelineStatusEntity.class,
|
||||
TimelineAccountEntity.class, ConversationEntity.class
|
||||
}, version = 20)
|
||||
}, version = 21)
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
|
||||
public abstract TootDao tootDao();
|
||||
|
@ -317,5 +317,12 @@ public abstract class AppDatabase extends RoomDatabase {
|
|||
database.execSQL("ALTER TABLE `ConversationEntity` ADD COLUMN `s_bookmarked` INTEGER NOT NULL DEFAULT 0");
|
||||
}
|
||||
};
|
||||
|
||||
public static final Migration MIGRATION_20_21 = new Migration(20, 21) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||
database.execSQL("ALTER TABLE `TootEntity` ADD COLUMN `markdownMode` INTEGER");
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,10 +65,14 @@ public class TootEntity {
|
|||
@Nullable
|
||||
@ColumnInfo(name = "poll")
|
||||
private final NewPoll poll;
|
||||
|
||||
@Nullable
|
||||
@ColumnInfo(name = "markdownMode")
|
||||
private final Boolean markdownMode;
|
||||
|
||||
public TootEntity(int uid, String text, String urls, String descriptions, String contentWarning, String inReplyToId,
|
||||
@Nullable String inReplyToText, @Nullable String inReplyToUsername,
|
||||
Status.Visibility visibility, @Nullable NewPoll poll) {
|
||||
Status.Visibility visibility, @Nullable NewPoll poll, @Nullable Boolean markdownMode) {
|
||||
this.uid = uid;
|
||||
this.text = text;
|
||||
this.urls = urls;
|
||||
|
@ -79,6 +83,7 @@ public class TootEntity {
|
|||
this.inReplyToUsername = inReplyToUsername;
|
||||
this.visibility = visibility;
|
||||
this.poll = poll;
|
||||
this.markdownMode = markdownMode;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
|
@ -123,6 +128,11 @@ public class TootEntity {
|
|||
public NewPoll getPoll() {
|
||||
return poll;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Boolean getMarkdownMode() {
|
||||
return markdownMode;
|
||||
}
|
||||
|
||||
public static final class Converters {
|
||||
|
||||
|
|
Loading…
Reference in New Issue