Skip to content

Conversation

@bgoncal
Copy link
Member

@bgoncal bgoncal commented Jan 8, 2026

Updated database deletion logic to use the deleteAll(db, keys:) method instead of filtering with contains and then calling deleteAll. This simplifies the code and leverages the keys-based deletion API.

Summary

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

Updated database deletion logic to use the deleteAll(db, keys:) method instead of filtering with contains and then calling deleteAll. This simplifies the code and leverages the keys-based deletion API.
@bgoncal bgoncal self-assigned this Jan 8, 2026
Copilot AI review requested due to automatic review settings January 8, 2026 13:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors database deletion operations in AppDatabaseUpdater.swift to use the deleteAll(db, keys:) method instead of chaining filter().deleteAll(db). The intent is to simplify code by leveraging GRDB's keys-based deletion API. However, the refactoring introduces critical bugs for two of the three changed methods.

Key changes:

  • Replaced filter-based deletion with keys-based deletion for three database models
  • Removed redundant serverId filtering that was already handled upstream

@bgoncal bgoncal enabled auto-merge (squash) January 8, 2026 13:51
@codecov
Copy link

codecov bot commented Jan 8, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@9c645df). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...ources/Shared/Environment/AppDatabaseUpdater.swift 0.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4186   +/-   ##
=======================================
  Coverage        ?   45.06%           
=======================================
  Files           ?      250           
  Lines           ?    14343           
  Branches        ?        0           
=======================================
  Hits            ?     6464           
  Misses          ?     7879           
  Partials        ?        0           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bgoncal bgoncal merged commit 1c38329 into main Jan 8, 2026
21 checks passed
@bgoncal bgoncal deleted the improve-db-updater branch January 8, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants