dmanjunath / node-redshift

A simple collection of tools to help you get started with Amazon Redshift from node.js
69 stars 48 forks source link

Implement undo a specific number of migrations #20

Closed thalesmello closed 7 years ago

thalesmello commented 7 years ago

This pull request allows the user to specify the number of migrations to undo.

dmanjunath commented 7 years ago

@thalesmello Thanks for the PR! I have one question. In the CLI for the db:migrate:undo function you have [name] as an optional argument. It should be [number of migrations to undo] right? Because you have Number.isNumber() to check that value.

thalesmello commented 7 years ago

@dmanjunath

It's actually a hybrid interface.

If the parameter the filename of one of the migrations, it passes it down to the node-migrate package, which in turn defines it as the state it has to rollback to.

If the parameter is an integer, then the logic inside uses that number to calculate the filename that correspond to that number of iterations.

I've included a few commits explaining how it works, also improving documentation.

dmanjunath commented 7 years ago

@thalesmello I see what you did. Thanks for the comments. I'll merge this branch on