migrate icon indicating copy to clipboard operation
migrate copied to clipboard

List migration entries feature

Open benedictjohannes opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. This package does not provide "List migrations" feature. This would likely be very useful especially for people using it interactivly, where it can list all migrations that is available while pointing at the same time at the current version. If the package is used within another package (not as CLI), it is trivial to create/print such a "list", but having it built in the package would be very nice.

Describe the solution you'd like For the CLI, a similar interface/function to Knex.JS would be nice, which printed out:

20220306052530_add_table1
20220322094839_add_table2
20220329082109_add_table3
Found 1 Pending Migration file/files.
20220329082109_add_table3

The formatting can be discussed, and for the package itself, having a Migrate.List() that returns an array of this can be added.

type MigrateEntry {
    IsCurrent bool
    fs.FileInfo
}

Describe alternatives you've considered Adding the "listing" when being integrated into another package is trivial, but having it integrated within the package itself would be really nice.

Additional context I myself had created such "listing" when using inside my own packages (like this), which printout something like this (current marked with X):

  -  20220118032102_notifiers.down.sql
  -  20220118032102_notifiers.up.sql
  -  20220124131604_triggers.down.sql
  -  20220124131604_triggers.up.sql
  -  20220128095600_account.down.sql
  X  20220128095600_account.up.sql
  -  20220128123547_connection.down.sql
  -  20220128123547_connection.up.sql

benedictjohannes avatar Apr 06 '22 06:04 benedictjohannes