Replace PouchDB with native CouchDB _replicate endpoint#138
Merged
Conversation
- 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.
This reverts commit 6455a0f.
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Addresses