Skip to content

tg db check and tg db backup #91

Open

Description

@neoromantic

There is no way to check a cache for damage or to copy it safely while the daemon writes. Some of a cache can't be fetched again: messages deleted on Telegram stay only in the local copy (is_deleted = 1).

Proposed:

  • tg db check [--account] [--full]: PRAGMA quick_check (or integrity_check with --full) and the FTS5 integrity-check of message_search, reported with the stable error schema. A damaged search index can be rebuilt from messages_cache; say how.
  • tg db backup [--account] --out <file>: a consistent copy with VACUUM INTO, which works while the daemon runs and also compacts the copy.
  • A short "Recovery" section in the docs: what a damaged cache loses, what tg fetches again, and what only the local copy has.

Done when e2e tests cover a clean cache, a damaged search index and a backup taken while another connection writes, and the docs describe both commands. Related: #80.

Activity

  1. added
    enhancement
    on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions