Is it possible to copy couchdb directly to sdcard

2019-09-11 06:15发布

I see that the couchdbs are stored in the /sdcard/Android/data/my.app.package/db/ as .couch files. I was trying to copy the couchdb directly to sdcard and make the couchdb service recognize it. We have a large amount of data in the cloud stored in couchdb and replicating it everytime during testing takes a lot of time and being able to copy it directly will hasten the development process. Is it possible to do this? if yes, how and is there any special care needed to make the android couchbase service recognize the couchdbs copied?

Thanks.

1条回答
唯我独甜
2楼-- · 2019-09-11 06:44

It is possible to copy .couch files between instances of CouchDB that share a common database format. If you've got two 1.1.0 CouchDB's, then you can cp (or similar) the .couch file into a running instance of another 1.1.0 CouchDB and it should "just work." Sometimes, you can successfully copy a .couch file "up" a version (ex: 1.1.0 to 1.2.0), but your mileage may vary.

I'm not sure what version of CouchDB the last active CouchDB for Android uses, but theoretically it would work the same--once you know what version it's based on.

TouchDB, the new CouchDB replication compatible database from Couchbase does not use the same .couch format, nor does Couchbase Server 2.0. Copying a .couch file from any version of CouchDB into one of those will not work as the database formats are significantly different (especially for TouchDB which uses SQLite underneath).

CouchDB-to-CouchDB, though, is typically fine as long as you keep an eye on the version numbers.

查看更多
登录 后发表回答