Skip to main content

migrate_dm_conversation

Function migrate_dm_conversation 

Source
pub fn migrate_dm_conversation(
    conn: &mut Connection,
    bootstrap: RoomBootstrap<'_>,
    state_events: &[NewStateEvent],
    bootstrap_origin_server_ts: i64,
    extras: DmMigrationExtras<'_>,
) -> Result<(Room, DmMigrationCounts), MatrixStoreError>
Expand description

The P12 migration’s own batch entry point: bootstrap’s room row, then every entry of state_events (identical shape to create_room_with_state’s own loop — same order requirement: a member’s m.room.member must precede m.room.power_levels for [refresh_power_levels] to see them, see that function’s own doc), then every extras.messages entry as an org.example.legacy_dm timeline event plus its legacy_dm_message_map row, then extras.receipts, then extras.direct_hints — all in ONE transaction. extras.messages must already be filtered by the caller to exclude any legacy_message_id already present in legacy_dm_message_map and ordered ascending by legacy_message_id; this function does not re-check either, since the binary crate’s own matrix_migration module already established the room does not exist yet via room_by_legacy_dm_id before ever calling this.