sublevel-migrate
Module to migrate from version 5 to 6 of sublevel
Last updated 6 years ago by cwmma .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install sublevel-migrate 
SYNC missed versions from official npm registry.

sublevel migrate

A module to migrate your databases from sublevel version 5 to sublevel version 6, if you only pass in a single db it changes it irrecoverably.

var migrate = require('sublevel-migrate');
var level = require('level');
migrate(level('oldDb'), level('newDb'), function (err) {
  if (err) {
    console.error('oh noes!', err);
  } else {
    console.log('done');
  }
});
// want to migrate it in place?
migrate(level('db'), function (err) {
  if (err) {
    console.error('oh noes!', err);
  } else {
    console.log('done');
  }
});

migrate to bytewise keys

level-sublevel@6 now supports bytewise encoding on keys, this means you can use (nearly) any js value as a key, and ordering is well defined. to migrate to bytewise keys, use

//this is how you ask for sublevel with bytewise keys:
var sublevel = require('level-sublevel/bytewise')

migrate.bytewise(oldDb, newDb, function (err) {
  //you can not use the new databaselike this:
  var db = newDb(sublevel)
})

Current Tags

  • 0.1.0                                ...           latest (6 years ago)

1 Versions

  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |