-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
Squashed migrations #39
Comments
How would this mechanism be applied? Is that a runtime feature that is executed when running |
This would be a runtime feature. Because we don't care about implementations of My vision of squash file is to follow syntax of migration file: 'use strict';
var Bluebird = require('bluebird');
module.exports = {
// List of migrations squashed in this squash file.
migrations: ['some-id', 'some-other-id'],
up: function () {
return new Bluebird(function (resolve, reject) {
// Describe how to achieve the task.
// Call resolve/reject at some point.
});
},
down: function () {
return new Bluebird(function (resolve, reject) {
// Describe how to revert the task.
// Call resolve/reject at some point.
});
}
}; When running These files should be stored in |
tbh I don't see a major benefit unless we are also implementing this:
are you planning to do this too? or are we just talking about the amount of migrations being executed? |
Yeah, of course, you got the point. 👍 |
Alright. The interesting part is that umzug is a framework agnostic tool which you may or may not use with Sequelize. While I don't mind have a good portion of sequelize specific helpers in umzug please keep in mind that umzug is can also be used without sequelize and with any available sequelize versions out there. |
Added support for squashed migrations. Running migrations will try to apply some squashes and run them as they were regular migrations. Running squash will (un)log multiple migrations at the same time. See [Django documentation][1] for more information of squashed migrations. [1]: https://docs.djangoproject.com/en/1.9/topics/migrations/#squashing-migrations
I agree, without this there wouldn't be an advantage. And this would clash with umzug being framework agnostic. I will close as wontfix. Maybe this can be implemented in the Sequelize CLI at some point. But I also think this is too complex to be worth it right now 😅 |
Is there any way to combine migrations to squashed migrations and run them instead of the original migrations? Currently no, I guess.
As you know, if there is a zillion of migrations, running them all from the beginning to the end may take a while. In addition, if you have [email protected] and you upgrade it to [email protected], performance of the database migration matters.
For example, Django have some kind of implementation for squashed migrations. I'm not sure if Django replaces migrations with squashed ones, but I think it's better to save them just in case. So there should be all the migrations plus some squashed migrations.
In the picture above, black dots are migrations created between releases. Bellow the migrations are squashed migrations. In this example, there are squashes for each minor and major release and one from the beginning to the latest release.
I think, in umzug, we need only
I can implement this feature but it needs some discussion first.
The text was updated successfully, but these errors were encountered: