perf: add node list indicies (#4056)

This commit is contained in:
Mac DeCourcy 2025-12-27 09:24:33 -08:00 committed by GitHub
parent d5475a0e0a
commit 3177609620
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 907 additions and 2 deletions

View file

@ -84,8 +84,9 @@ import org.meshtastic.core.database.entity.TracerouteNodePositionEntity
AutoMigration(from = 23, to = 24),
AutoMigration(from = 24, to = 25),
AutoMigration(from = 25, to = 26),
AutoMigration(from = 26, to = 27),
],
version = 26,
version = 27,
exportSchema = true,
)
@TypeConverters(Converters::class)

View file

@ -96,7 +96,18 @@ data class MetadataEntity(
)
@Suppress("MagicNumber")
@Entity(tableName = "nodes")
@Entity(
tableName = "nodes",
indices =
[
Index(value = ["last_heard"]),
Index(value = ["short_name"]),
Index(value = ["long_name"]),
Index(value = ["hops_away"]),
Index(value = ["is_favorite"]),
Index(value = ["last_heard", "is_favorite"]),
],
)
data class NodeEntity(
@PrimaryKey(autoGenerate = false) val num: Int, // This is immutable, and used as a key
@ColumnInfo(typeAffinity = ColumnInfo.BLOB) var user: MeshProtos.User = MeshProtos.User.getDefaultInstance(),