-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Migrate to Xormigrate #31523
base: main
Are you sure you want to change the base?
Migrate to Xormigrate #31523
Conversation
Thanks @qwerty287! I need to reply to your email, but thanks for getting started on this. |
This reverts commit 7d417e0.
I think this is ready for a first review round. Tests pass both in CI and also in my manual tests, everything seems to work. |
Co-authored-by: delvh <dev.lh@web.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we currently lack sufficient motivation to change our migration method.
@lunny we currently have at least 5 people in favor of this change (@techknowlogick and @delvh + 2 more from PR reactions + me) while you're the only one argumenting in the other direction |
@lunny @techknowlogick Please review code and discussion. It's really frustrating seeing PRs like this ignored. Just think of people contributing the first time - you think that increases the probability that they'll continue contributing to open source? |
Well, it happens a lot. See my "pings" of these screenshots. I guess there will be some new "sorrys" for this PR. And it is always a shame that some of the TOC team do not fulfill the responsibilities. So , to be honest, at the moment, either:
|
My concern is still not addressed: #31523 (comment) (even it is not documented ..... that's a risk)
So , if "don't do backports", then I guess the PR doesn't fulfill its purpose "This allows backporting migrations", if there is no significant benefits, why take the risk to touch the stable existing migration mechanism? I do not mean saying "no", I just want to make everything clear, to get rid of risks. It happens a lot in history that a "good-looking mechanism" would leave some hard-to-fix problems or regressions. |
@wxiaoguang please check out #31523 (comment) for some answers to your questions |
My opinions:
For example:
The "backporting" problem is more complicated that it looks, just like you said: "We usually don't do backports at woodpecker anymore." So " if there is no significant benefits (no need to do so), why take the risk to touch the stable existing migration mechanism?" |
Well, from the comment above:
|
It looks quite trivial to me because Gitea already have heavily customized a lot of modules, include http/web/router/logger/queue/template/frontend, etc. Nothing is Gitea is really like "other software" at the moment. So making the migration system like or unlike others doesn't really matter.
Why it ever needed to "no-op migrations"? As long as there is no backporting.
It also involves "backporting", which is the most risky (unclear) part in this mechanism. |
That's actually a good question, but to me it seems some migration were removed, maybe because they're not necessary anymore. There are a lot of no-ops currently in the code, and removing them is not possible because of the int-based migration system. That would not be a problem with xormigrate: Removing a migration is possible without any problems due to its name-based system. |
These no-op are mainly related to fix some legacy problems, but not related to backporting, instead, they have a hard dependency of the following migration, so, literally they are "replaced". Actually they do not need to be really removed (no-op), keeping the old code there would still be fine (just some duplicate or unnecessary changes). For example, it ever added a table, then dropped that table. When using a name-based migration system, there should be a separate step to "remove the migration ID from database", otherwise there will be an unknown migration ID in database. It couldn't be simpler than "no-op". |
This could be directly added into xormigrate to have an automatic "cleanup" of this table. |
After a quick code read, I think this PR's change is not mature (so if let me decide, I would also say "block" for it). If we would really like to do it:
But, before starting the work, I would like to see people have the consensus first: is it really worth to introduce xormigrate? (at the moment, my answer is no because the benfits seem quite trival to me, the potential risks(bugs/regressions) might be more than benefits) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Migrate to Xormigrate or not, we need this first: Refactor the DB migration system slightly #32344 By #32344 , each migration has a clear id number, it does help the problem in #31523 (comment):
|
As an update, I am starting a discussion with the other maintainers regarding this PR and possibly creating a formal RFC. There are the concerns above, and I hear/understand them. Our contribution document allows all maintainers to have a voice, which I hope will be able to feed into an RFC to allow for a robust approach that satisfies everyone. Another big thank you to @qwerty287 for their work on his PR already. |
Migrate the migration handling to xormigrate instead of the native handling.
The main difference between the methods: gitea has a version-based system, xormigrate uses id-based. This means: In theory, each migration could be executed standalone (xormigrate will however execute them in order).
This allows backporting migrations, and xormigrate is already in use in projects like woodpecker ci (and is working well there).