when trying to migrate to gitea-1.22-windows-4.0-amd64.exe the service doesn’t want to start any more. see log file above :
2024/04/30 17:15:03 cmd/web.go:194:serveInstalled() [I] PING DATABASE mssql
2024/04/30 17:15:03 …dels/db/collation.go:184:preprocessDatabaseCollation() [W] Current database is using a case-insensitive collation “French_CI_AS”, although Gitea could work with it, there might be some rare cases which don’t work as expected.
2024/04/30 17:15:03 …ations/migrations.go:688:Migrate() [I] Migration[286]: Add support for SHA256 git repositories
2024/04/30 17:15:03 routers/init.go:72:mustInitCtx() [F] code.gitea.io/gitea/routers/common.InitDBEngine(ctx) failed: migrate: migration[286]: Add support for SHA256 git repositories failed: DROP INDEX IF EXISTS [IDX_commit_status_context_hash] ON [commit_status] mssql: Incorrect syntax near the keyword ‘IF’.
It’s impossible to go back to previous release of gitea because database is newer.
so first things first… do you have a backup?
I know this doesn’t help you now but I run weekly backups and always take a backup prior to an upgrade “just in case”.
Gitea-1.22 isn’t released yet but is in a release-candidate stage and a final release is imminent so there is a high chance if you were using rc0 that this is a bug and thus rc1 will resolve this issue. Can you confirm which version of gitea-1.22.windows-4.0-amd64.exe you are using? gitea-1.22.0-rc1-gogit-windows-4.0-amd64.exe was release last week
if you are using rc1 and/or this doesn’t fix your issue, you can try using gitea doctor to “repair” aspects of the database. I execute this pre-upgrade and post-upgrade as a “just in case” measure and once or twice it did find something not right and it did repair.
Finally… SHA256 git repositories was introduced (stable) in git-v2.42 (august 2023) so if you are using an older version it might be worth upgrading to git-v2.42
Seems you are running MSSQL 2012 or older which is barely within the supported range of Gitea. Upgrading to 2016 should work, but we are also trying to fix this.