From a830d499ebff01236833f2384a0f4e90786ba60d Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Tue, 7 Jan 2020 16:31:26 +0300 Subject: [PATCH] Add autodelete timer columns to message table --- src/sql.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/sql.rs b/src/sql.rs index 1bcc19679..86d94e062 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -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)