diff --git a/src/sql/migrations.rs b/src/sql/migrations.rs index 805295d71..3c6064c1d 100644 --- a/src/sql/migrations.rs +++ b/src/sql/migrations.rs @@ -2610,6 +2610,22 @@ UPDATE msgs SET state=24 WHERE state=18; -- Change OutPreparing to OutFailed. .await?; } + inc_and_check(&mut migration_version, 164)?; + if dbversion < migration_version { + sql.execute_migration( + "CREATE TABLE transport_usage( + contact_id INTEGER NOT NULL, + transport_id INTEGER NOT NULL, + last_seen INTEGER NOT NULL DEFAULT 0, + PRIMARY KEY(contact_id, transport_id), + FOREIGN KEY(contact_id) REFERENCES contacts(id) ON DELETE CASCADE, + FOREIGN KEY(transport_id) REFERENCES transports(id) ON DELETE CASCADE + ) STRICT", + migration_version, + ) + .await?; + } + let new_version = sql .get_raw_config_int(VERSION_CFG) .await?