-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
1.22 upgrade migration fail, postgres 16 column not created - cannot revert #31205
Comments
what version of git do you have |
Hey @eeyrjmr |
Sorry, I mean to write gitea doctor gitea doctor check --all. |
NB:
I should point out too that obviously everything was running fine prior and I update gitea pretty frequently. No config changes have been made, though we did migrate from mysql -> postgres about 2 or 3 months ago. |
Could you run the doctor command with 1.22 gitea doctor check --all --fix Also when you say you converted mysql to postgress 2-3 months ago, had you upgraded gitea between then? Gitea doctor also has a command to recreate tables |
I was fairly sure that was with 1.22, but I might have swapped it back and forgotten, here's the new output - though I think it's the same (without anything omitted this time)
There's a slim chance we converted mysql > postgres right after the
I'm happy to leave it "broken" as is for a few hours if you want me to test a few things, there's no urgency and I'm happy to do whatever is needed. |
This is the correct command to attempt to recreate the tables but you appear to be using the previous version again. |
Nah, it's 1.22. To be sure I set
|
Grabbed it straight from here: https://github.com/go-gitea/gitea/releases/tag/v1.22.0
As a note, if we have to start over it's not the end of the world. I'm assuming that part of the migration didn't work correctly, or it wasn't performed correctly. Spinning up a new VM and copying stuff over would be a pain, but that's life sometimes :) edit; I could always restore and test with the |
so this is saying the present db is 286 (ie 1.21) and its trying to migrate to 299 (ie 1.22) gitea/models/migrations/migrations.go Lines 546 to 590 in ab458ce
but aspects of the db are inconsistent with itself so it can't complete migration. You the tried to run your original (earlier) version and hit and 280 is 1.21 so the migrator replays the upgrade process v280 -> v281 -> v282 ... to ensure all steps are completed. Something failed for you and it was stuck at v286 -> v287, which is the AdjustDBForSha256, which would align with the error message you are seeing.
might need a maintainers help with accessing the db and adjusting aspects of the db to allow the migration to continue. |
This is the migration code and the likely error part... |
The only way I can imagine to fix it is below but I cannot reproduce it in my local macOS + postgres 16(docker based) -_, err := x.Exec("UPDATE repository set object_format_name = 'sha1' WHERE object_format_name = '' or object_format_name IS NULL")
+_, err := x.Exec("UPDATE repository set `object_format_name` = 'sha1' WHERE `object_format_name` = '' or `object_format_name` IS NULL")
|
…31209) (go-gitea#31218) Backport go-gitea#31209 by @lunny Try to fix go-gitea#31205 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> (cherry picked from commit 68e405c)
Description
postgres 16.3/debian 12
when attempting upgrade:
when attempting to revert:
Gitea Version
1.22
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
debian
How are you running Gitea?
binary release
Database
PostgreSQL
The text was updated successfully, but these errors were encountered: