Database redesign
Our database in Sqlite currently consists of these tables:
table! {
message (id) {
id -> Integer,
session_id -> BigInt,
source -> Text,
#[sql_name="message"]
text -> Text,
timestamp -> BigInt,
sent -> Bool,
received -> Bool,
flags -> Integer,
attachment -> Nullable<Text>,
mime_type -> Nullable<Text>,
has_attachment -> Bool,
outgoing -> Bool,
}
}
table! {
sentq (message_id) {
message_id -> Integer,
timestamp -> BigInt,
}
}
table! {
session (id) {
id -> BigInt,
source -> Text,
message -> Text,
timestamp -> BigInt,
sent -> Bool,
received -> Bool,
unread -> Bool,
is_group -> Bool,
group_members -> Nullable<Text>,
group_id -> Nullable<Text>,
group_name -> Nullable<Text>,
has_attachment -> Bool,
}
}
!46 (merged) demonstrates a way to migrate from both a 0.5 and a 0.6-initialized database, including how to test it. It also ships a new version of these three tables.
I suggest we remodel the database to account for all of the new Signal features. This will minimize the amount of migrations we'll have to account for in the future. We can just leave the currently unknown fields empty.