Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

feat: add ui store migrations#333

Merged
OGPoyraz merged 1 commit intomainfrom
feat/ui-store-migrations
Jan 26, 2023
Merged

feat: add ui store migrations#333
OGPoyraz merged 1 commit intomainfrom
feat/ui-store-migrations

Conversation

@OGPoyraz
Copy link
Copy Markdown
Member

@OGPoyraz OGPoyraz commented Dec 14, 2022

Overview

This PR aims to add an implementation of UI store migration base.
Since we persist two different stores (pair-status and root) we need individual migration functions for each.
All persisted store versions will start from 0 and it will increment once migration happens.

Example migration implementation

  • Increment migration version (For example, make rootPersistedConfig version 0 to 1)
  • Add a migration file under packages/app/ui/migrations/root/m1.js
  • Add file reference to index.js with version and migration function
const migrations = {
  // version: migration function
  1: m1,
  2: m2,
  3: m3,
  //...
};
  • Fill migration function

How to reproduce migration in local

  • Start app with migration version 0 for the store you want to migrate
  • Kill app
  • Increment version number by 1
  • Set createMigrate function option debug to true (packages/app/ui/ducks/index.js)
  • Start app (it will also run migrations)
  • You can use UI developer tools to debug since that migration happens on UI

@OGPoyraz OGPoyraz force-pushed the feat/ui-store-migrations branch 4 times, most recently from def7639 to 792ec3b Compare December 16, 2022 08:10
@OGPoyraz OGPoyraz marked this pull request as ready for review December 16, 2022 08:15
@OGPoyraz OGPoyraz requested a review from a team December 16, 2022 08:15
@OGPoyraz OGPoyraz force-pushed the feat/ui-store-migrations branch 3 times, most recently from e1a0a4c to 453a8d6 Compare December 16, 2022 09:23
@OGPoyraz OGPoyraz changed the base branch from main-desktop to main January 4, 2023 16:09
@OGPoyraz OGPoyraz force-pushed the feat/ui-store-migrations branch from ff8121b to 8be2eff Compare January 6, 2023 08:41
@OGPoyraz
Copy link
Copy Markdown
Member Author

@matthewwalsh0 if I am not mistaken, you suggested importing all migration files and generating migrations objects after reading through migration folders. But since this is still in the UI they are bundled together and going that way will be a bit overkill IMO.

But if this is not what you were suggesting, forgive me, time passed since I opened this PR, barely remember :)

@OGPoyraz OGPoyraz force-pushed the feat/ui-store-migrations branch 2 times, most recently from 714a930 to 3a601ee Compare January 26, 2023 11:25
@OGPoyraz OGPoyraz force-pushed the feat/ui-store-migrations branch from 3a601ee to 8bd40cb Compare January 26, 2023 11:37
@OGPoyraz OGPoyraz merged commit 59cd354 into main Jan 26, 2023
@OGPoyraz OGPoyraz deleted the feat/ui-store-migrations branch February 1, 2023 07:48
@cryptotavares cryptotavares mentioned this pull request Mar 1, 2023
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