Supporting multiple versions with ability to downport to old versions #1139
Replies: 2 comments 4 replies
-
to clarify, you mean backports, OK.
well v1.1, you'd be releasing v1.1.2, so you'd make D against 1.1 as you did for v1.1.2 and have that lead up to v1.1.2
you'd need to forwards port into 2.2 a mechanism to not re-apply D,which could be that you forwards-port the 1.1 -> D -> 1.1.2 stream into 2.2. Or otherwise modfy 2.2 so that it expects D might be present already.
that sounds like a great feature.
other than "use django", not really, sorry :) |
Beta Was this translation helpful? Give feedback.
-
Hi, Can't you use two branches, one for new features and one for bugfixes?
You then add D that's a bugfix you end up with these two state
The v1.1.1 (assuming the fix was released as version 1.1.1)
When you update the application to versio 2.2 the migration D is already there so alembic will skip it |
Beta Was this translation helpful? Give feedback.
-
I am hoping to support multiple versions of an app, but I am having a hard time thinking of how Alembic would be able to support database patches to prior versions.
To give an example, lets say I have App v1.1, which has revisions that look like this:
So three migrations were made, then merged and applied for the app. Then let's say I start work on App v1.2, and Now my migrations look like this:
However, let's say that revision D was a bug fix, and I need the SQL schema changes in v1.1. What can I do?
If I apply the changes via a SQL script to all the products that are on V1.1, it will fix the issue, but when it comes time to upgrade them to v1.2, the migrations are now broken, because one of them was already applied to the V1.1 databases.
In some other projects (such as Django), I might be able to get around this, because rather than the version table tracking where I am in history, it instead tracks what has already been applied. So theoretically, I could apply the revision in V1.1, and not have my migrations break when I eventually upgrade the app to V1.2 (because it would skip applying the bug fix migration, since it was already applied).
Is there something that I am missing? I don't see an easy way to address this, and from looking at issues/discussions online, I haven't seen this brought up. However, I may be overlooking something simple.
Beta Was this translation helpful? Give feedback.
All reactions