[WIP] Add unpublished flag for transports

This commit is contained in:
Hocuri
2026-03-15 17:36:01 +01:00
parent bf02785a36
commit d1a3d6fcca
5 changed files with 77 additions and 2 deletions

View File

@@ -2343,6 +2343,24 @@ ALTER TABLE contacts ADD COLUMN name_normalized TEXT;
.await?;
}
// Add a `published` flag to transports.
// Unpublished transports are not advertised to contacts,
// and self-sent messages are not sent there.
// The default is published, but when updating,
// existing secondary transports are set to unpublished,
// so that an existing transport address doesn't suddenly get spammed with a lot of messages.
inc_and_check(&mut migration_version, 149)?;
if dbversion < migration_version {
sql.execute_migration(
"ALTER TABLE transports ADD COLUMN published INTEGER DEFAULT 1;
UPDATE transports SET published=0 WHERE addr!=(
SELECT value FROM config WHERE keyname='configured_addr'
)",
migration_version,
)
.await?;
}
let new_version = sql
.get_raw_config_int(VERSION_CFG)
.await?