Use this guide to move your copy of Nuits Receipts to a newer release. A release only tags the code; nothing updates your deployment until you deploy it. Read the Changelog first to see what changed, especially under Breaking changes.
Prerequisites
- Wrangler signed in to the account that runs the Worker (
bunx wrangler login). - A local clone of the code you deploy from: the repository you cloned for
bun run setup, or the repository the Deploy button created in your GitHub or GitLab account. - Bun 1.4.2 or later.
Back up first
Pending database migrations are applied during the deploy. Take a backup before every upgrade.
Export the database
bunx wrangler d1 export <database name> --remote --output backup.sql --config wrangler.production.jsoncUse your D1 database name (
my-nuits-receiptsunless you changed it). With the Deploy button, run it from your clone and leave out--configif you have no private config. Keepbackup.sqlsomewhere private: it holds your receipt data.Note a Time Travel point
bunx wrangler d1 time-travel info <database name> --config wrangler.production.jsoncThis prints the current bookmark, which you can restore to with D1 Time Travel if the upgrade goes wrong. D1 also takes a backup when migrations are applied.
Your original files live in R2 and are not changed by an upgrade.
Upgrade from the command line
Get the new code
Pull the release into your clone, for example
git pull, orgit checkout v1.2.3for a specific tag. Yourwrangler.production.jsoncis gitignored and is not touched.Install the dependencies
bun install --frozen-lockfileCheck the config
bun run deploy -- --dry-runA newer release can add variables or tighten checks. The dry run lists any variable that needs fixing without touching your account.
Deploy
bun run deployThe script lists pending migrations, applies them (Wrangler asks you to confirm in an interactive shell), then deploys. If anything fails, the Worker is not deployed.
If your config uses its own migrations folder or table (an older private install), the script stops and asks for a backup. After taking one, run
bun run deploy -- --apply-migrations.
Upgrade a Deploy button copy
The Deploy button created a separate repository in your account, not a fork, so it does not follow new releases by itself. Every push to its production branch builds and deploys through Workers Builds, which runs bun run deploy.
Add the original repository as a remote
In your clone, once:
git remote add upstream https://github.com/bapspatil/nuits-receipts.gitMerge the release
git fetch upstream --tags git merge v1.2.3Replace
v1.2.3with the release you want. If Git refuses with “refusing to merge unrelated histories”, your copy was created without the original history; add--allow-unrelated-historiesto the first merge. Ifwrangler.jsoncconflicts, keep your own names,varsand routes, and take the release’s other changes.Check, then push
bun install --frozen-lockfile bun run deploy -- --dry-run git pushThe push starts a build. Follow it in your Worker’s Deployments or Builds page in the Cloudflare dashboard.
Check it worked
- The deploy or build log ends without errors, after “Deployed” or the build’s success message.
- Open the app and sign in. The footer shows the new version number.
- Open Settings and check that your values are still there, each marked Set in the app, Set when deployed or Built-in default.
If the build fails at the D1 migrations step with an authentication or permission error, see Troubleshoot.
After upgrading to v2.0.0
v2.0.0 makes Home the archive of every finance document. It brings one new database migration, 0012_archive, which the deploy applies like any other. It only adds: a column for each file’s searchable words, and tables for other documents, tags, stars and notes, saved searches and recently opened files. No existing data is changed.
Backups keep working the same way. wrangler d1 export still exports the whole database, which is why search does not use full-text search tables (the export refuses databases that have them).
Files you added before the upgrade can be found by their details (seller, amounts, dates, file name) at once, but not yet by the words inside them. To index them:
Open the search settings
Open Settings, then Advanced, and find Search. It says how many older files can be found by their details but not yet by the words inside them.
Index the older files
Select Index older files (N left). Each press reads 25 files. Press it again until the section says “Every file can be found by the words inside it.”
Home also reads a few older files on every visit, so the count goes down by itself over time. Pressing the button more than once does no harm: a file is indexed once.
Bank statement PDFs imported before v2.0.0 were not kept, only the CSV they were converted to. Those statements show as a table. Old links to Receipts All (/receipts?view=all) now open Home. See Find any document.
Related
- Changelog
- Deploy from the command line for how the deploy script picks its config and resolves the database.
- Data model for the D1 tables a migration may change.