Expand description
One-time database migrations.
A fresh database is stamped current and a legacy database is walked through the named migrations, once the version and server name gates decide it is safe to touch.
ModulesΒ§
- account_
status π - clear_
servername_ πstatus - conduit π
- email_
bindings π - fix_
bad_ πdouble_ separator_ in_ state_ cache - fix_
hashed_ πsentinel_ passwords - fix_
readreceiptid_ πreadreceipt_ duplicates - fix_
referencedevents_ πmissing_ sep - import_
conduit_ πknocks - injectivity π
- Short id injectivity: the one-time scan and repair.
- migrate_
media π - migrate_
profile_ πkeys - moderation π
- rebuild_
roomid_ πtscount_ pducount - remove_
remote_ πmedia_ userid - retroactively_
fix_ πbad_ data_ from_ roomuserid_ joined - split_
conduit_ πhighlight_ counts - upgrade_
legacy_ πmediaid_ user
ConstantsΒ§
- DATABASE_
VERSION π - The current schema version.
- FORCE_
MIGRATION_ πDELAY - FOREIGN_
LINEAGE_ πMARKER - 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. - SERVER_
NAME_ πKEY
FunctionsΒ§
- backfill_
server_ πname - 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.
- check_
database_ πversion - 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. - check_
server_ πname - 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.
- fresh π
- is_
foreign_ πlineage - 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.
- local_
user_ πid - Assembles a local user id from a localpart a foreign column records.
- migrate π
- Apply any migrations
- migrations π
Type AliasesΒ§
- User
IdBuf π - Inline budget for a local user id assembled from a foreign localpart.