A marker written by a sibling conduwuit-lineage server but never by tuwunel.
Its presence identifies a foreign database at a higher schema number even
after tuwunel has stamped its own server_name, so a database opened by
both servers in turn keeps booting rather than being refused as too new.
Stamp the marker on a database that pre-dates SERVER_NAME_KEY by probing
for any user from the configured server. If none, the database belongs
to a different server and reuse is refused.
Gate the discovered schema version before migrations and the server_name
backfill run. The integer is comparable only within tuwunelβs own lineage; a
foreign database (Conduit and forks) numbers schema on a colliding ladder
and is recognized as foreign by is_foreign_lineage, so its number is not
gated. Within our lineage a version below 13 is refused as unmigratable and
one above this build as too new to open safely; force_migration overrides
the latter for a deliberate downgrade.
Matrix resource ownership is based on the server name; changing it
requires recreating the database from scratch. The marker is stamped
once in fresh(); pre-marker databases are backfilled by probing for
any user from the configured server.
Imports a Conduit databaseβs pending knocks once. Gated on its own marker
and the source columnβs presence, so it runs only for a Conduit database and
only the first time; a re-import would resurrect a knock the user later
resolved.
Whether the database comes from a foreign (non-tuwunel) lineage: it predates
our SERVER_NAME_KEY stamp, or carries a conduwuit-lineage migration marker
that persists even after we stamp ours. Must be read before the server_name
backfill, which removes the first signal.
Imports a Conduit databaseβs content-addressed media into tuwunelβs
key-addressed store when it is present and not yet imported; otherwise runs
the key-addressed media migrations.
Relocates the per-user displayname and avatar_url out of their dedicated
columns into the unified useridprofilekey_value store keyed by MSC4133 field
name, where the profile service now reads them. The dedicated columns are
left intact, so an older binary opening the same database still resolves.
Splits a Conduit databaseβs conflated highlight-count column once. Conduit
aliased roomuserid_lastnotificationread onto the
userroomid_highlightcount tree, so one column holds both stores; tuwunel
keeps them apart. Gated on its own marker; the split itself returns early
unless a room-keyed row is present, so it is a cheap no-op on a native
database.