Documentation menuMigrating to 2.0
Migrating to 2.0
What changes from Vector 1.x to 2.0 and how to upgrade, step by step.
Vector 2.0 adds ordered delivery, payload filters, replay, pruning and a versioned database schema. The sending API of 1.x keeps working. This page lists everything that can break and how to fix it. Vector 1.x receives security and bug fixes for 12 months after the release of 2.0.0.
Breaking changes
- Node.js 22 or newer. Node 20 reached end of life; 2.0 declares
engines.node >=22. - Database schema version 2. Three nullable columns are new (
filteron endpoints,ordering_keyon messages and deliveries), plus an index and a<prefix>schematable that records the version. Runawait store.migrate()once after updating; it adds what is missing and is safe on every deploy. The SQL returned bysqliteSchema(),mysqlSchema()andpostgresSchema()is for fresh installs; if you manage migrations with your own tool, use the new SQL as the target and write analter table ... add columnfor each column above, or simply callstore.migrate()at startup. - New fields on stored objects.
Endpoint.filter(PayloadFilter | null),Message.orderingKeyandDelivery.orderingKey(string | null) are always present. Code that builds these objects by hand (tests, fixtures) must add them withnull. - Custom stores.
VectorStorehas two new methods:deleteMessagesBefore(before, limit)andschemaVersion(), andclaimDueDeliveriesmust skip a pending delivery while an earlier pending delivery of the same endpoint andorderingKeyexists. If you only useMemoryStore,SqliteStore,MysqlStoreorPostgresStore, nothing to do.MessageQueryalso has an optionalbeforeIdfor stable paging. - Vector Pro packages 2.x need
@sweberdev/vector2.x. Install both from the same major version. Existing Pro and Lifetime licences stay valid.
What 1.x code does not need to change
send, sendMany, endpoints, signing, retries, process/start, the CLI and the adapters behave as in 1.x. No exports were renamed; nothing marked @deprecated remained in 1.x.
Upgrade steps
- Update the package:
npm install @sweberdev/vector@2(or@nextwhile 2.0 is a release candidate). - Update Node.js to 22 in CI and in production.
- Deploy once so that
await store.migrate()runs, or run it from a script. Old workers can keep running during a rolling deploy: the new columns are nullable and 1.x ignores them. - Optionally check
await store.schemaVersion(); it returns2afterwards. - If you have a custom
VectorStore, add the two methods and the ordering rule, and run your tests. - Update Pro packages together to the same 2.x version.
New in 2.0
orderingKeyonsend: per-key ordered delivery. See Sending.filteron endpoints: payload conditions. See Sending.vector.replay()andvector.prune(). See Replaying history and Operations.store.schemaVersion()and theSCHEMA_VERSIONexport.
Rolling back
Going back to 1.x is safe: the extra columns are ignored by 1.x. Ordered messages sent under 2.0 are delivered without ordering by 1.x.