Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

feat: migration 10 to allow upgrading level in the browser #59

Merged
merged 2 commits into from
Jan 29, 2021

Conversation

achingbrain
Copy link
Member

We use the level module to supply either leveldown or level-js to datastore-level depending on if we're running under node or in the browser.

level@6.x.x upgrades the level-js dependency from 4.x.x to 5.x.x which includes the changes from Level/level-js#179 so >5.x.x requires all database keys/values to be Uint8Arrays and they can no longer be strings.

We already store values as Uint8Arrays but our keys are strings, so here we add a migration to converts all datastore keys to Uint8Arrays.

N.b. leveldown already does this conversion for us so this migration only needs to run in the browser.

We use the [level](https://www.npmjs.com/package/level) module to supply
either [leveldown](http://npmjs.com/package/leveldown) or
[level-js](https://www.npmjs.com/package/level-js)
to [datastore-level](https://www.npmjs.com/package/datastore-level) depending
on if we're running under node or in the browser.

`level@6.x.x` upgrades the `level-js` dependency from `4.x.x` to `5.x.x`
which includes the changes from
[Level/level-js#179](Level/level-js#179)
so `>5.x.x` requires all database keys/values to be Uint8Arrays and they
can no longer be strings.

We already store values as Uint8Arrays but our keys are strings, so here
we add a migration to converts all datastore keys to Uint8Arrays.

N.b. `leveldown` already does this conversion for us so this migration
only needs to run in the browser.
@achingbrain achingbrain merged commit 7dc562b into master Jan 29, 2021
@achingbrain achingbrain deleted the feat/migration-10 branch January 29, 2021 15:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants