Skip to content
This repository has been archived by the owner on Dec 13, 2019. It is now read-only.

Basic approach to one off migration #2563

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Basic approach to one off migration #2563

wants to merge 11 commits into from

Conversation

snario
Copy link
Contributor

@snario snario commented Oct 28, 2019

This adds a basic migration script from all previous data schemas to the new one. There are only two major transformations from the previous pull requests. The first is that the data is now all stored under the key ${storeKeyPrefix} and the second is that some uses of { _hex: string } to represent a BigNumber have been changed to string.

@rhlsthrm
Copy link
Collaborator

This looks good. I am currently testing out the migration process to make sure the newly migrated channels work properly. Can we export this function from the node? I'd like to be able to import the function into a script we can call from the CLI.

@@ -15,6 +15,7 @@ import {
import { prettyPrintObject } from "./utils";

interface SharedData {
version: 1; // TODO: Add better versioning & migrations tooling
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From looking around it seems like there are various ways of versioning a db schema.

Though I'm kinda confused as to why the version number is being put in SharedData? I'm also confused how this handles migrations overall if there are no typed schemas between the versions?

Maybe we should have a separate blob that holds both the version number and the schema at the corresponding version number. The migration script would then just diff n-1 and n to apply the migration.

Copy link
Contributor Author

@snario snario Oct 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StoreData = { schemaVersion: number, data: SharedData } ?

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.

None yet

3 participants