Skip to content

Migrate vault entries to new schema #2092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ekzyis
Copy link
Member

@ekzyis ekzyis commented Apr 11, 2025

Description

This PR replaces the existing VaultEntry table which links to a row in the generic Wallet table (and to a row in the users table) with a new table Vault where columns in the specific wallet tables like WalletNWC link to it.

TODO:

  • migrate existing vault entries to new schema
  • upsertWalletXXX mutation
    • write to new Vault table
    • stop writing to old VaultEntry table
  • wallets query
    • read from new Vault table instead of from old VaultEntry table
  • remove models.vaultEntry calls
    • injectResolvers
    • getVaultEntries query
    • updateVaultKey mutation
    • clearVault mutation
    • checkWallet job
  • remove TODO_newName
  • delete VaultEntry table
  • Q&A

Screenshots

Additional Context

tbd

Checklist

Are your changes backwards compatible? Please answer below:

tbd

On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:

tbd

For frontend changes: Tested on mobile, light and dark mode? Please answer below:

n/a

Did you introduce any new environment variables? If so, call them out explicitly here:

no

@ekzyis ekzyis added the wallets label Apr 11, 2025
@ekzyis ekzyis marked this pull request as draft April 11, 2025 02:57
@ekzyis ekzyis force-pushed the wallet-refactor-migrate-vault branch 5 times, most recently from 5729ce6 to b35f1f7 Compare April 15, 2025 17:13
@ekzyis ekzyis force-pushed the wallet-refactor-migrate-vault branch 8 times, most recently from 1423528 to 5f09dea Compare April 16, 2025 05:31
lib/object.js Outdated
Copy link
Member Author

@ekzyis ekzyis Apr 16, 2025

Choose a reason for hiding this comment

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

I ended up only using get to access properties via a nested path like a.b.c (see tests).

I'll remove the other object helper functions if they don't turn out to be helpful in other places even though they have already been tested.

this isn't outdated, it just says so because I rebased the branch

Copy link
Member Author

@ekzyis ekzyis Apr 16, 2025

Choose a reason for hiding this comment

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

I didn't test the migration with Blink and Phoenixd, only made sure that it looks good so far.

I want to test them with wallets from production since attaching Blink or Phoenixd with only mainnet support is hard in regtest mode.

this isn't outdated, it just says so because I rebased the branch

Comment on lines +355 to +356
nwcUrlSendId Int? @unique
nwcUrlSend Vault? @relation(fields: [nwcUrlSendId], references: [id])
Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, instead of TODO_newName in the wallet def, I could just use nwcUrl instead of nwcUrlSend. Then the new schema would match the existing typedef. Same for WalletBlink.

@@ -16,7 +16,8 @@ export const fields = [
.matches(/^blink_[A-Za-z0-9]+$/, { message: 'must match pattern blink_A-Za-z0-9' }),
help: `you can get an API key from [Blink Dashboard](${galoyBlinkDashboardUrl}).\nPlease make sure to select ONLY the 'Read' and 'Write' scopes when generating this API key.`,
requiredWithout: 'apiKeyRecv',
optional: 'for sending'
optional: 'for sending',
TODO_newName: 'apiKeySend'
Copy link
Member Author

Choose a reason for hiding this comment

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

Dear future @ekzyis, see other comment regarding TODO_newName

@ekzyis ekzyis force-pushed the wallet-refactor-migrate-vault branch from 5f09dea to 7dbdc2e Compare April 16, 2025 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant