Skip to content

How to Upgrade

Rahil Pirani edited this page Jun 2, 2026 · 3 revisions

Upgrading is just pulling the latest code and redeploying. No new environment variables needed (unless the release notes say otherwise).


Which setup do you have?

Not sure? Here’s how to tell:

  • One-click deploy – You clicked a “Deploy to Cloudflare” button in the README to get started
  • Manual deploy – You cloned or forked the repo yourself and ran commands in a terminal

If you used the one-click “Deploy to Cloudflare” button

Step 1: Go to your repo on GitHub

It will be at github.com/YOUR-USERNAME/second-brain-cloudflare (whatever name you gave it during setup).

Step 2: Sync with the latest version

  1. On your repo’s main page, look for the “Sync fork” button (it appears when your copy is behind the original)
  2. Click it, then click “Update branch”

Step 3: Run database migrations

Some versions add new columns to the database. Run these in the Cloudflare D1 console to make sure your database is up to date:

  1. Go to Workers & Pages in the left sidebar
  2. Click D1 in the left sidebar
  3. Select your second-brain database
  4. Click the Console tab and run each of the following, one at a time (ignore “duplicate column” errors – that just means you already have it):
ALTER TABLE entries ADD COLUMN vector_ids TEXT NOT NULL DEFAULT '[]';
ALTER TABLE entries ADD COLUMN recall_count INTEGER DEFAULT 0;
ALTER TABLE entries ADD COLUMN importance_score INTEGER DEFAULT 0;

Step 4: Verify the deployment

  1. Go to Workers & Pages in the left sidebar
  2. Click on your Worker
  3. Check the Deployments tab – you should see a new deployment at the top with a recent timestamp

If the deployment shows an error, check the build logs on that same page for details.


If you used the manual deploy (fork + terminal)

Step 1: Pull the latest changes

git pull upstream main

If you haven’t set up the upstream remote yet, run this first:

git remote add upstream https://github.com/rahilp/second-brain-cloudflare.git

Then retry the git pull command above.

Step 2: Install dependencies

npm install

Step 3: Run database migrations

Some versions add new columns to the database. Run these via Wrangler to make sure your database is up to date (ignore “duplicate column” errors – that just means you already have it):

npx wrangler d1 execute second-brain --command "ALTER TABLE entries ADD COLUMN vector_ids TEXT NOT NULL DEFAULT '[]'"
npx wrangler d1 execute second-brain --command "ALTER TABLE entries ADD COLUMN recall_count INTEGER DEFAULT 0"
npx wrangler d1 execute second-brain --command "ALTER TABLE entries ADD COLUMN importance_score INTEGER DEFAULT 0"

Replace second-brain with your actual D1 database name if you named it something different during setup.

Step 4: Redeploy

npx wrangler deploy

Step 5: Verify

Open your web UI or send a test recall from Claude. If it responds normally, you’re good.


Something went wrong?

Open an issue at github.com/rahilp/second-brain-cloudflare/issues and include:

  • Which upgrade method you used
  • The error message you saw
  • Which version you were on and which you upgraded to

Clone this wiki locally