Add autodelete timer columns to message table

This commit is contained in:
Alexander Krotov
2020-01-07 16:31:26 +03:00
parent 49e821d029
commit a830d499eb

View File

@@ -910,6 +910,25 @@ fn open(
)?;
sql.set_raw_config_int(context, "dbversion", 64)?;
}
if dbversion < 65 {
info!(context, "[migration] v65");
// Timer value in seconds. For incoming messages this
// timer starts when message is read, so we want to have
// the value stored here until the timer starts.
sql.execute(
"ALTER TABLE msgs ADD COLUMN autodelete_timer INTEGER;",
NO_PARAMS,
)?;
// Timestamp indicating when the message should be
// deleted. It is convenient to store it here because UI
// needs this value to display how much time is left until
// the message is deleted.
sql.execute(
"ALTER TABLE msgs ADD COLUMN autodelete_timestamp INTEGER;",
NO_PARAMS,
)?;
sql.set_raw_config_int(context, "dbversion", 65)?;
}
// (2) updates that require high-level objects
// (the structure is complete now and all objects are usable)