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

Basic approach to one off migration - #2563

Open
snario wants to merge 11 commits into
masterfrom
liam/migrateBasics
Open

snario wants to merge 11 commits into
masterfrom
liam/migrateBasics

Conversation

@snario

@snario snario commented Oct 28, 2019

Copy link
Copy Markdown
Contributor

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.

@snario
snario requested a review from cf19drofxots as a code owner October 28, 2019 14:00
@rhlsthrm

Copy link
Copy Markdown
Contributor

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.

@snario
snario requested a review from joelalejandro as a code owner October 29, 2019 11:50
import { prettyPrintObject } from "./utils";

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

Copy link
Copy Markdown
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.

@snario snario Oct 30, 2019

Copy link
Copy Markdown
Contributor Author

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.

3 participants