-
Notifications
You must be signed in to change notification settings - Fork 9
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
add support for running all migration files regardless of timestamp #21
add support for running all migration files regardless of timestamp #21
Conversation
I'm not sure if this PR would satisfy the request on #20. As fas as I understood it, the request was to run a single migration by name (which could be done by matching filenames in migration directory). |
@vinicius0026 you're right, I was confused by that issue since you referred to it in another issue and searching the issue queue now, I see that I never actually reported this problem (though I remember I did), but basically the issue is that you should be able to support just running migration files regardless of time the last migration was inserted into the database. Use case:
In timeline perspective this happens:
Then I run both of them and insert into the database. Problem: when he merges the code and execute migrations his That's one use case but there are other reasons for why you wouldn't want to impose the rule of only inserting migrations that are newer than the timestamp on the db. |
@lirantal Now I understand your point, but I'm not sure this is the best way to go. In the described use case, suppose your work and the work from your colleague are merged. Then you both would have to update your local repositories and run migrations again. This would cause your migrations to be run twice in your machine, and his migrations would run twice on his, which could yield errors and would require guards against them in migrations code. I think a better way to deal with the situation you describe is replacing the logic that filters migrations by their timestamp by some that checks in the migrations metadata table which migrations were run and which were not, and then run only the un-run migrations. What are your thoughts? |
If you mean that we would run migrations again because we'll need to update our codebase and run new migrations, then how would we run the same migration twice? Also, the notion of coupling migrations with the date they executed is something that I see for the first time. Sequelize and other libraries of other languages don't have this (http://docs.sequelizejs.com/manual/tutorial/migrations.html). What I like about the approach in this PR is that rethinkdb-migrate stays as is and doesn't break for anyone who wishes to keep using the same functionality, but rather they can opt-in for the newly proposed migrations execution method. |
@lirantal You're right! Its been a while since I last read this code. Merging this right now. And I think we should drop |
Thanks. |
@lirantal I'm not sure if anyone relies on this at all. It was a bad design decision on my side, never had second thoughts about it until now. |
Addresses #20
The addition of the extra
i
or--ignore-timestamp
flag isn't breaking any functionality and enables running all migrations, regardless of timestamp.