Skip to content

fix(pkpass): create PKPass passType column on fresh install - #727

Merged
farfromrefug merged 2 commits into
mainfrom
fix/725-pkpass-passtype-migration
Sep 14, 2026
Merged

farfromrefug merged 2 commits into
mainfrom
fix/725-pkpass-passtype-migration

Conversation

@farfromrefug

@farfromrefug farfromrefug commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Fresh CardWallet installs crashed on adding a pass (table PKPass has no column named passType, [BUG] Error while importing passkey #725) and on importing an image (table Page has no column named qrcode, [BUG] Sqlite error when importing image #722). Root cause is shared: an unguarded ADD COLUMN (sourceSize) collided with createTables on fresh installs and threw, aborting the whole migration loop before the later ADD COLUMN migrations (qrcode, colors, pkpass_id, passType) ran.
  • Route every ADD COLUMN through an idempotent guard so one already-applied column can never abort the migration sequence again.
  • Make each createTables declare the full current schema (all columns + indexes); on a brand new database, record migrations as applied instead of replaying history.
  • Dedup the Document/Page search-column backfill into a shared helper.

Testing

  • npx eslint app/services/documents.ts — clean; yarn svelte-check — 0 errors.
  • Ran on device: fresh install (import image + pass + add QR card), upgrade from existing DB, non-card document-scanner build. All fine.

Refs #725
Refs #722

farfromrefug and others added 2 commits September 13, 2026 16:33
PKPass.passType only existed via the addPassType migration, but an unguarded
ADD COLUMN (sourceSize) collided with createTables on fresh installs and aborted
the whole migration loop, so addPassType never ran.

Route every ADD COLUMN through an idempotent addColumn guard, declare the full
current schema in each createTables, and on a fresh database record migrations as
applied instead of replaying them. Dedup the search-column backfill.

Refs #725

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@farfromrefug farfromrefug added the bug Something isn't working label Sep 14, 2026
@farfromrefug
farfromrefug marked this pull request as ready for review September 14, 2026 08:39
@farfromrefug
farfromrefug merged commit 1f8e59e into main Sep 14, 2026
1 check passed
@farfromrefug
farfromrefug deleted the fix/725-pkpass-passtype-migration branch September 14, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant