mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
fix: Check for custom-defined cache when migrating.
This commit is contained in:
parent
e6e3bcc994
commit
cb21894828
11
package-lock.json
generated
11
package-lock.json
generated
@ -12609,12 +12609,6 @@
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/immediate": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz",
|
||||
"integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==",
|
||||
"extraneous": true
|
||||
},
|
||||
"node_modules/import-fresh": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
|
||||
@ -39893,11 +39887,6 @@
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"immediate": {
|
||||
"version": "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz",
|
||||
"integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==",
|
||||
"extraneous": true
|
||||
},
|
||||
"import-fresh": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
|
||||
|
@ -6,7 +6,7 @@ const logger = Logger.create('orbit-db')
|
||||
Logger.setLogLevel('ERROR')
|
||||
|
||||
export default async function migrate (OrbitDB, options, dbAddress) {
|
||||
let oldCache = OrbitDB.caches[options.directory] ? OrbitDB.caches[options.directory].cache : null
|
||||
let oldCache = options.cache || (OrbitDB.caches[options.directory] ? OrbitDB.caches[options.directory].cache : null)
|
||||
let oldStore
|
||||
|
||||
if (!oldCache) {
|
||||
|
@ -152,7 +152,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
await db2.close()
|
||||
})
|
||||
|
||||
it.skip('loads cache from previous version of orbit-db', async () => {
|
||||
it('loads cache from previous version of orbit-db', async () => {
|
||||
const dbName = 'cache-schema-test'
|
||||
|
||||
db = await orbitdb.create(dbName, 'keyvalue', { overwrite: true })
|
||||
@ -164,14 +164,14 @@ Object.keys(testAPIs).forEach(API => {
|
||||
await db.drop()
|
||||
|
||||
await fs.copy(migrationFixturePath, migrationDataPath, { filter: filterFunc })
|
||||
db = await orbitdb.create(dbName, 'keyvalue')
|
||||
db = await orbitdb.create(dbName, 'keyvalue', { directory: migrationDataPath, overwrite: true })
|
||||
await db.load()
|
||||
|
||||
assert.equal(manifestHash, db.address.root)
|
||||
assert.equal((await db.get('key')), 'value')
|
||||
})
|
||||
|
||||
it.skip('loads cache from previous version of orbit-db with the directory option', async () => {
|
||||
it('loads cache from previous version of orbit-db with the directory option', async () => {
|
||||
const dbName = 'cache-schema-test'
|
||||
const directory = path.join(dbPath, "some-other-place")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user