-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Closed
Copy link
Labels
Description
Description
postgres 16.3/debian 12
when attempting upgrade:
routers/init.go:73:mustInitCtx() [F] code.gitea.io/gitea/routers/common.InitDBEngine(ctx) failed: migrate: migration[286]: Add support for SHA256 git repositories failed: pq: column "object_format_name" does not exist
when attempting to revert:
2024/06/01 07:30:37 ...ations/migrations.go:628:Migrate() [F] Migration Error: Your database (migration version: 286) is for a newer Gitea, newer database for this old Gitea release (280).
Gitea will exit to keep your database safe and unchanged. Please use the correct Gitea release, do not change the migration version manually (incorrect manual operation may lose data).
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
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
[-]1.22 upgrade migration fail, cannot revert[/-][+]1.22 upgrade migration fail, postgres 16 column not created - cannot revert[/+]eeyrjmr commentedon Jun 1, 2024
what version of git do you have
also have you tried using git doctor to perform some repair tasks
jamiew0w commentedon Jun 1, 2024
Hey @eeyrjmr
I don't use docker - i've updated the issue to specify i run the binary. the git version is
2.39.2
- the most up-to-date version in debian https://packages.debian.org/bookworm/giteeyrjmr commentedon Jun 1, 2024
Sorry, I mean to write gitea doctor
gitea doctor check --all.
jamiew0w commentedon Jun 1, 2024
NB:
gitea --config app.ini migrate
also fails: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.
eeyrjmr commentedon Jun 1, 2024
Could you run the doctor command with 1.22
Aspects of the migration has completed so there is no way back (besides backups).
gitea doctor check --all --fix
Also when you say you converted mysql to postgress 2-3 months ago, had you upgraded gitea between then?
I wonder if the changing dB wasn't compete .
Gitea doctor also has a command to recreate tables
jamiew0w commentedon Jun 1, 2024
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
1.21.11
release which would explain why we haven't had issues since. I don't recall any issues with that migration at the time either.gitea migrate
: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.
eeyrjmr commentedon Jun 1, 2024
This is the correct command to attempt to recreate the tables but you appear to be using the previous version again.
jamiew0w commentedon Jun 1, 2024
Nah, it's 1.22. To be sure I set
chmod -x
on the old binaries, plus specified the newly downloaded release from github: EG./gitea
just in case. Here's the output showing the version number too:jamiew0w commentedon Jun 1, 2024
Grabbed it straight from here: https://github.com/go-gitea/gitea/releases/tag/v1.22.0
gitea-1.22.0-linux-amd64
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 :)
I just wanna be mindful of wasting your guys time (thanks for your help thus far too!)
edit; I could always restore and test with the
1.22.0-rc1
too, though I doubt there'd be much difference. It doesn't look like anyone else has reported this issue too, so it must be a mistake on our end.eeyrjmr commentedon Jun 1, 2024
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
2024/06/01 07:30:37 ...ations/migrations.go:628:Migrate() [F] Migration Error: Your database (migration version: 286) is for a newer Gitea, newer database for this old Gitea release (280).
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.
eeyrjmr commentedon Jun 1, 2024
https://github.com/go-gitea/gitea/blob/ab458ce10be59669c810ba43af41f2ba2e72ea5b/models/migrations/v1_22/v286.go#L84C1-L97C2
This is the migration code and the likely error part...
lunny commentedon Jun 1, 2024
The only way I can imagine to fix it is below but I cannot reproduce it in my local macOS + postgres 16(docker based)
Fix the possible migration failure on 286 with postgres 16 (#31209)
Fix the possible migration failure on 286 with postgres 16 (go-gitea#…
Fix the possible migration failure on 286 with postgres 16 (#31209) (#…
Fix the possible migration failure on 286 with postgres 16 (go-gitea#…