Skip to content
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

Problem with migrating down #187

Open
mkovel opened this issue Apr 24, 2021 · 1 comment
Open

Problem with migrating down #187

mkovel opened this issue Apr 24, 2021 · 1 comment

Comments

@mkovel
Copy link

mkovel commented Apr 24, 2021

Hi, @wesleytodd
I'm trying to create a custom SQL store for migrations, and I want to store migrations log not as one json stringified row.
I want organized it as one row - one migration.

All works fine for up migrations but for down migrations in save method I have problems.
I can't understand the context (up or down) of invoking save method.
And I see two reasons.

  1. save does not have access to direction value.
  2. set.lastRun has a specific value, that does not reflect really last running migration for down. lastRun has incorrect value when migrating down #142
    But I understand that this trick with lastRun allows work whole system in general.

So I see two ways how it can be fixed.

  1. add lastDirection prop to set.
    image

  2. Change/extend signature of store save method. Add third argument context. save(set, fn, ctx);
    And pass the context with { direction } to store.save.
    image
    image

I can prepare PR if you agree with my suggestion and select one of them.

@mkovel
Copy link
Author

mkovel commented May 5, 2021

@wesleytodd @tj Guys what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant