Skip to content

fix(db): Revert removal of retry_count#4527

Merged
jamesarich merged 1 commit into
meshtastic:mainfrom
jamesarich:fix/db-schema
Feb 11, 2026
Merged

fix(db): Revert removal of retry_count#4527
jamesarich merged 1 commit into
meshtastic:mainfrom
jamesarich:fix/db-schema

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

This reverts commit 207c485, re-adding the retry_count column to the packet and reactions tables.

A new database migration from version 34 to 35 has been created to undo the previous deletion of these columns.

This reverts commit 207c485, re-adding the `retry_count` column to the `packet` and `reactions` tables.

A new database migration from version 34 to 35 has been created to undo the previous deletion of these columns.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 11, 2026 01:20
@github-actions github-actions Bot added the bugfix PR tag label Feb 11, 2026
@jamesarich jamesarich merged commit a575e0f into meshtastic:main Feb 11, 2026
5 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reverts a prior schema change by attempting to re-introduce the retry_count column to the Room database, using a new DB version bump and auto-migration.

Changes:

  • Bumps MeshtasticDatabase version from 34 → 35 and adds an auto-migration entry for 34 → 35.
  • Adds a new AutoMigration34to35 spec.
  • Modifies the exported Room schema JSON for version 34 to include retry_count in packet and reactions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
core/database/src/main/kotlin/org/meshtastic/core/database/MeshtasticDatabase.kt Adds DB version 35 and a 34→35 auto-migration spec intended to restore retry_count.
core/database/schemas/org.meshtastic.core.database.MeshtasticDatabase/34.json Updates exported schema content/identity hash and adds retry_count to table definitions (but for v34).
Comments suppressed due to low confidence (1)

core/database/schemas/org.meshtastic.core.database.MeshtasticDatabase/34.json:306

  • The createSql for packet/reactions in the version-34 schema now includes retry_count, but the current Room entities in core/database/.../entity/Packet.kt do not define a retry_count column. This mismatch will cause Room schema validation/auto-migration generation to fail (exported schema must match the entities for that version). Update the entities to include retry_count (with a default) and ensure the exported schema version that contains it is the current one (v35), not v34.
      {
        "tableName": "packet",
        "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uuid` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `myNodeNum` INTEGER NOT NULL DEFAULT 0, `port_num` INTEGER NOT NULL, `contact_key` TEXT NOT NULL, `received_time` INTEGER NOT NULL, `read` INTEGER NOT NULL DEFAULT 1, `data` TEXT NOT NULL, `packet_id` INTEGER NOT NULL DEFAULT 0, `routing_error` INTEGER NOT NULL DEFAULT -1, `retry_count` INTEGER NOT NULL DEFAULT 0, `snr` REAL NOT NULL DEFAULT 0, `rssi` INTEGER NOT NULL DEFAULT 0, `hopsAway` INTEGER NOT NULL DEFAULT -1, `sfpp_hash` BLOB, `filtered` INTEGER NOT NULL DEFAULT 0)",
        "fields": [
          {
            "fieldPath": "uuid",
            "columnName": "uuid",

Comment on lines +135 to +136
@DeleteColumn(tableName = "packet", columnName = "retry_count")
@DeleteColumn(tableName = "reactions", columnName = "retry_count")

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AutoMigration34to35 is annotated with @DeleteColumn for retry_count, which does the opposite of the PR goal (re-adding the column). This will also likely make Room’s auto-migration generation/validation fail because the 34→35 schema diff should be an add column change, not a delete. Remove the @DeleteColumn spec for 34→35 (or remove the spec entirely if Room can auto-add the columns), and ensure the entities define retry_count with a default so Room can add a NOT NULL column safely.

Suggested change
@DeleteColumn(tableName = "packet", columnName = "retry_count")
@DeleteColumn(tableName = "reactions", columnName = "retry_count")

Copilot uses AI. Check for mistakes.
Comment on lines 92 to 99
AutoMigration(from = 31, to = 32),
AutoMigration(from = 32, to = 33),
AutoMigration(from = 33, to = 34, spec = AutoMigration33to34::class),
AutoMigration(from = 34, to = 35, spec = AutoMigration34to35::class),
],
version = 34,
version = 35,
exportSchema = true,
)

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change bumps the DB version to 35, but the only migration-specific logic added is a second delete-column spec. If the intention is to restore retry_count, the schema/entities need to reintroduce the column (with a default) so Room can generate an ADD COLUMN migration; otherwise version 35 will still match the current entities (no retry_count) and the migration won’t actually restore anything.

Copilot uses AI. Check for mistakes.
Comment on lines 3 to 6
"database": {
"version": 34,
"identityHash": "25bf8e7feb6d0e7f9eab4dfccf546e45",
"identityHash": "34352663e54f76b7b9c13de31d9ac8e7",
"entities": [

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

34.json should describe the schema for database version 34, but this diff changes it to include the retry_count columns and updates the identityHash. That makes the historical schema inconsistent with the declared migration path (33→34 deletes retry_count, and the PR description says 34→35 re-adds it). Revert the edits to 34.json and instead update/add the exported schema for version 35 to reflect the restored columns.

Copilot uses AI. Check for mistakes.
@codecov

codecov Bot commented Feb 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 14.46%. Comparing base (fd90aa3) to head (2a2db3d).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4527      +/-   ##
==========================================
+ Coverage   14.42%   14.46%   +0.04%     
==========================================
  Files         424      424              
  Lines       14521    14522       +1     
  Branches     2410     2410              
==========================================
+ Hits         2094     2101       +7     
+ Misses      12124    12117       -7     
- Partials      303      304       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jamesarich jamesarich deleted the fix/db-schema branch February 20, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants