Skip to main content

tuwunel_service/migrations/
split_conduit_highlight_counts.rs

1use tuwunel_core::Result;
2
3use super::{conduit::migrate_conduit_highlight_split, pending};
4use crate::Services;
5
6/// Splits a Conduit database's conflated highlight-count column once.
7///
8/// Conduit aliased `roomuserid_lastnotificationread` onto the
9/// `userroomid_highlightcount` tree, so one column holds both stores; tuwunel
10/// keeps them apart. Gated on its own marker; the split itself returns early
11/// unless a room-keyed row is present, so it is a cheap no-op on a native
12/// database.
13pub(super) async fn split_conduit_highlight_counts(services: &Services) -> Result {
14	if pending(services, "split_conduit_highlight").await? {
15		migrate_conduit_highlight_split(services).await?;
16		services.db["global"].insert("split_conduit_highlight", []);
17	}
18
19	Ok(())
20}