Skip to content

Replace PouchDB with native CouchDB _replicate endpoint#138

Merged
mohagan9 merged 25 commits into
mainfrom
chore/replace-pouchdb
Jun 28, 2026
Merged

Replace PouchDB with native CouchDB _replicate endpoint#138
mohagan9 merged 25 commits into
mainfrom
chore/replace-pouchdb

Conversation

@mohagan9

Copy link
Copy Markdown
Member

Description

  • Replication: use CouchDB _replicate with design document filter instead of PouchDB's source.replicate.to()
  • DatabaseImpl: replace PouchDB dump/load with allDocs/bulkDocs, createIndex/deleteIndex with nano/CouchDB _index API
  • Remove pouchdb, @budibase/pouchdb-replication-stream, pouchdb-adapter-memory dependencies
  • Remove replication:true config from server/worker db init
  • Remove pouchdb from esbuild externals
  • Clean up Replication class: remove close(), appReplicateOpts(), add ReplicateOpts interface

Addresses

mohagan9 and others added 25 commits June 27, 2026 15:12
- Replication: use CouchDB _replicate with design document filter instead of PouchDB's source.replicate.to()
- DatabaseImpl: replace PouchDB dump/load with allDocs/bulkDocs, createIndex/deleteIndex with nano/CouchDB _index API
- Remove pouchdb, @budibase/pouchdb-replication-stream, pouchdb-adapter-memory dependencies
- Remove replication:true config from server/worker db init
- Remove pouchdb from esbuild externals
- Clean up Replication class: remove close(), appReplicateOpts(), add ReplicateOpts interface
CouchDB 3.5.1 _replicate fails with design doc filters over HTTP URLs
(changes_req_failed,400). Replaced with replicate-all + cleanup approach:
1. _replicate all docs (no filter)
2. cleanupTarget() reads target docs and bulk-deletes those not matching
   the filter logic (ported from JS filter to TypeScript shouldKeepDoc)
3. 17 end-to-end integration tests (no couch mocking) verifying
   direction, replication, filtering, and rollback behavior
db.init(opts.db) called the removed PouchDB initialization function.
Worker/server db/index.ts still call core.init() — make it a no-op
since nano/CouchDB needs no client-side initialization.
Document._id is optional, so filter callbacks using optional chaining
return boolean|undefined. Accept that in the filter type and coerce
to boolean in shouldKeepDoc.
- Remove pendingColumnRenames from Table type
- Remove applyPendingColumnRenames, clearPendingColumnRenames, getRevisionNumber functions
- Remove dev-production rev sync block in publish (only used for renames)
- Remove unused mergePendingColumnRenames helper
@mohagan9 mohagan9 merged commit b65de1b into main Jun 28, 2026
20 of 26 checks passed
@mohagan9 mohagan9 deleted the chore/replace-pouchdb branch June 28, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants