Skip to content

fix: add the 2.8 sync columns to homepage and vault tables on upgrade - #1791

Open
ZacharyZcR wants to merge 1 commit into
Termix-SSH:mainfrom
ZacharyZcR:fix/legacy-plugin-sync-columns
Open

ZacharyZcR wants to merge 1 commit into
Termix-SSH:mainfrom
ZacharyZcR:fix/legacy-plugin-sync-columns

Conversation

@ZacharyZcR

Copy link
Copy Markdown
Member

Fixes Termix-SSH/Plugin-Sync#8. That server was upgraded 2.5.1 → 2.9.2 → 26.11.0 on SQLite and logs no such column: "sync_id" on every sync pass.

2.8 added these columns on start (release-2.8.0-tag, src/backend/database/db/index.ts):

addColumnIfNotExists("vault_profiles", "sync_id", "TEXT");
addColumnIfNotExists("dashboard_service_links", "sync_id", "TEXT");
addColumnIfNotExists("dashboard_service_links", "updated_at", "TEXT");
addColumnIfNotExists("homepage_items", "sync_id", "TEXT");

2.9 handed those tables to plugins and dropped that code. The plugins' adoption migrations use CREATE TABLE IF NOT EXISTS followed by a rename, so an existing 2.5 table keeps its columns. A database that skipped 2.8 therefore never gets them. Homepage and Vault define syncId on the adopted tables, so every sync read of those rows fails and that kind of data is skipped. Snippets had the same gap and already has a repair in core. Homepage and Vault did not.

This runs the existing repair over these tables too, under their legacy and adopted (p_…) names. It adds the missing columns, fills a sync_id for every row and creates the unique index, the same way it does for snippets. The columns come from comparing the plugins' current table definitions with 2.5.1's schema: homepage_items and vault_profiles only miss sync_id, dashboard_service_links also misses updated_at, and homepage_layouts misses nothing. Vault's provider column comes from its own migration. Since the repair now covers more than snippets, the file and function are renamed (legacy-plugin-columns.ts, repairLegacyPluginColumns).

Validation: a new test builds the three tables with their 2.5.1 columns under the adopted names, as on the reporter's server, and checks the columns and filled sync ids after repair. It fails with the previous table list. Full suite: 4638 passed, 1 skipped. tsc -b, eslint, prettier and the test location check pass.

2.8 added sync_id to dashboard_service_links, homepage_items and
vault_profiles, and updated_at to dashboard_service_links, on start. 2.9
handed those tables to plugins and dropped that code, so a SQLite database
upgraded from 2.5 straight to 2.9 or later never got the columns. The
plugins read sync_id from their adopted tables, and sync logged "no such
column: sync_id" on every pass while skipping that data.

Run the existing snippets repair over these tables too, under both their
legacy and adopted names, and fill a sync_id for every row. The repair is
renamed to match.

Fixes Termix-SSH/Plugin-Sync#8
@termix-triage-bot

Copy link
Copy Markdown

AI review | Needs changes

Adds missing sync and timestamp columns to legacy homepage and vault tables during SQLite upgrades to resolve sync failures for databases that skipped version 2.8. The change is safe, follows repository rules, and includes appropriate tests.

  • major Core PRs should target the current dev-* branch, not main. If no dev-* branch exists yet, ignore this.

Reviewed 0d2b562. AI can be wrong, a maintainer still decides. Comment /termix review to run it again.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Open PRs

Development

Successfully merging this pull request may close these issues.

Sync plugin: repeated "no such column: sync_id" errors after upgrade

1 participant