Skip to content

Problem with migrating down #187

@mkovel

Description

@mkovel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions