Once you customise NocoCRM, your code and the official NocoCRM repository (upstream, below) move forward separately. This page explains how to merge a new upstream version while keeping your own changes.
Versions and tags
Every NocoCRM version is tagged in the repository as v1.0.0-beta.N; see the tags page on GitHub. Merge the version of a tag rather than an arbitrary commit on the main branch.
Upgrade the NocoBase foundation
Each NocoCRM version is built on a NocoBase application template version, recorded in nocobase.defaultTemplateVersion in package.json. It is separate from NocoCRM's own version number. Merging a new upstream version upgrades the foundation along with it, and that is the recommended way.
If you urgently need a fix from a newer NocoBase and upstream has not upgraded yet, you can upgrade first yourself; see Upgrade NocoBase Core. When handing it to a coding agent, just say "upgrade NocoBase". When you later merge upstream:
package.json,pnpm-lock.yamland the framework code (client/routing/,client/layouts/and so on) may conflict. Take the higher of the two sides for dependency versions anddefaultTemplateVersion, and regenerate the lockfile withpnpm install.- After upgrading, besides the usual checks, confirm that the Agents, mail, approvals and notifications work, and run
pnpm exec vitest run tests/logic/authorization-assignment-safety.test.ts.
Merge a new upstream version
-
Back up: back up the database and the
storage/directory. -
Add the upstream repository (once only):
git remote add upstream https://github.com/nocobase/NocoCRM.git -
Merge on a new branch:
git fetch upstream --tags git switch -c upgrade-nococrm git merge v1.0.0-beta.N -
Resolve conflicts: for each conflicting file, work out what upstream changed and what you changed, and keep the intent of both sides; do not simply overwrite one side with the other. You can hand this step to a coding agent, telling it what your customisations changed.
-
Install dependencies and run migrations:
pnpm install pnpm nocobase db apply -
Check: run
pnpm typecheckandpnpm test, then start the application and confirm that sign-in, the pages and fields you customised, and the new version's features all work. -
Once everything is right, merge the branch back into your main branch and deploy as usual.
To make later merges smoother:
- Keep customisations in new files where you can, and change upstream's large files as little as possible.
- Write down the reason wherever you make a change, so you can later decide how to resolve a conflict.
- Do not change code for what you can adjust in the interface; see below.
What to watch with migrations
- Do not edit upstream's migrations: a merged migration is history, and editing it causes a checksum mismatch.
- Give your migrations their own file names: use timestamps that differ from upstream's, and names that show they are yours, to avoid name clashes.
- Checksum warnings: upstream occasionally revises a published migration, for example for PostgreSQL or MySQL compatibility. If startup reports a checksum mismatch after an upgrade, run
pnpm nocobase db repairin a terminal; add--dry-runfirst to see what it would change. - Approval processes are frozen by version: if you changed approval statuses or transitions (a version 2 definition) and upstream has also added a process version, compare the two definitions by hand when you merge.
Customisations stored in the database
The following adjustments are stored in the database. They need no merging when you upgrade and are kept as they are:
- business configuration in System settings, approver rules, roles and permission sets;
- business guidance, and the background Agents' models, instructions and switches;
- skills changed in the interface.
A built-in skill you have changed is no longer updated by upgrades. To use upstream's new content, compare it in System settings › AI › Skills with ai/skills/<name>/SKILL.md in the repository and merge by hand.
Files to keep when you upgrade
When you upgrade the code, the following are not in the repository and must be kept as they are:
config.yml: itssecrets.keysencrypt the saved model keys, API keys, mailbox credentials and WhatsApp tokens. Change the keys and those credentials can no longer be decrypted.- Environment variables: such as
SECRETS_KEYS, the database connectionDB_*, andAPP_BASE_PATHandAPP_PUBLIC_ORIGIN. - The
storage/directory: the default SQLite databasestorage/crm.sqlite, and uploaded attachments.
The built deployment package contains no configuration, database or uploaded files, so keep them when you deploy a new version too.