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
New rules for migrations #341
Comments
Proposal 1: "one by one" & calendar based releasesWe guarantee that each DB version is compatible with procrastinate's previous codebase. This means that in a single version, we can always run the migrations for the next version. High availability upgrade strategy for X to Z:
This means that if you need to upgrade 10 versions at once, you'll need 20 upgrade steps. In order to limit the steps, we should be avoiding making new versions that modify SQL too often. Thus we suggest adopting a calendar-based release with at most monthly releases. What it means in terms of code:
|
Proposal 2: "one by one on major versions" with checkpoints(by @elemoine) We guarantee that each release within a major version X is compatible with the database at version X+1.0 (the "checkpoint" version). High availability upgrade strategy for X.5 to Z.5:
We can imagine that major versions are less frequent than "any release", thus this would limit the steps needed compared to proposal 1. What it means in terms of code:
|
Proposal 3 : Proposal 2 but checkpoint is X.99We guarantee that each release within a major version X is compatible with the database at version X.99 (the "checkpoint" version). High availability upgrade strategy for X.5 to Z.5:
What it means in terms of code:
|
2 or 3 for me, I'm fine with both. So I presume it's a vote for 3 too |
I think I'm ok with proposition 3, but I find the ".99" a bit confusing. Would formulating it this way work?
|
I'm not sure this would be true. We're talking about a real |
Do you have examples of projects doing this? I find it very unusual. Plus when we'll make the .99, what tells us that we won't have another minor version to make? I feel like there is a simpler option, but I can't get my head around it. I'm not sure it's Option 2 either. |
That would imply we would support older versions. I think the plan for now is just to support the latest one.
Do you have examples for non-django projects integrated as libraries into users project and that require SQL migrations ? |
Another proposal could be to postpone cleaning after X+2.0, which would lead to your suggestion above Note: proposal 2 is like proposal 3 without the .99, so that would work too. |
The advantage of proposal 3 (the "0.99" proposal) is that we don't need to wait for X+1.1 to remove the SQL code for backward compatibility. Instead we can do the clean-up directly in X+1.0. So with proposal 3 we'd release X.99 just before releasing X+1.0. And we'd tell our users that they need to upgrade to the X.99 pivot version before upgrading to X+1. With proposal 2 we'd release X+1.0, and X+1.1 right after for the SQL clean-up. And we'd tell our users that they need to upgrade to X+1.0 before upgrading to any other X+1 version. We can also recommend that they upgrade from X+1,0 to X+1.1 as soon as X+1.1 comes out, although that's not required. With that I mind I think I prefer proposal 2, because it'd be more natural and usual to our users. With proposal 3, when they are ready to upgrade to the next major version (from X.n to X+1.0), we would force them to do 2 upgrades, from X.n to X.99, and them from X.99 to X+1.0. With proposal 2, they can upgrade from X.n to X+1.0, and then, optionally, from X+1.0 to X+1.1. @ewjoachim, what do you think? I can go ahead and document the migration process when we agree on the proposal. |
Frankly, I'm ok with anything as long as it's documented. |
Here is my first attempt at documenting this: #342. |
See #100 for our first iteration.
Why
We need to provide a way to run migrations while procrastinate runs, which means we need each each version of the schema to be compatible with 2 at least versions of the code (and likewise, each version of the code to be compatible with at least 2 versions of the schema).
How
We can be quite limiting at start (e.g. only upgrading versions 1 by 1 is supported)
Let's flesh out proposals below.
The text was updated successfully, but these errors were encountered: