Skip to content
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

Database migration fails when attempting to upgrade from version 1.20.5 #28247

Closed
snoopydo opened this issue Nov 28, 2023 · 6 comments · Fixed by #28643
Closed

Database migration fails when attempting to upgrade from version 1.20.5 #28247

snoopydo opened this issue Nov 28, 2023 · 6 comments · Fixed by #28643
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail

Comments

@snoopydo
Copy link

Description

When attempting to upgrade from version 1.20.5 (windows gogit x64), the migrations fail and service stops.
In the log there are 10x

2023/11/28 13:13:58 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: migrate: get: mssql: Invalid usage of the option NEXT in the FETCH statement.

enabling logsql and verbose logging i see

2023/11/28 13:29:55 ...orm@v1.3.4/engine.go:1246:Get() [I] [SQL] SELECT [id], [version] FROM [version] WHERE [id]=? ORDER BY [id] ASC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY [1]

That syntax isn't supported by MSSQL until version 2012 at least. Documentation says 2008 R2 SP3 is supported.

Gitea Version

windows gogit x64 1.20.5

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.42.0.windows.2

Operating System

Windows Server 2012

How are you running Gitea?

Running as a service, using prebuilt binaries downloaded from releases tab from github

Database

MSSQL

@lng2020
Copy link
Member

lng2020 commented Nov 28, 2023

https://gitea.com/xorm/xorm/pulls/2188 xorm changed the implementation 2 months ago. We better update the docs.

@snoopydo
Copy link
Author

Gitea 1.20.5 was only released a month ago.
Looking at the query, it appears to have been unnecessarily over complicated, a simple select top 1 sql query is all that is need. MS docs say to use TOP and only use OFFSET and FETCH in paging queries.

@wxiaoguang
Copy link
Contributor

-> Require MySQL 8.0, PostgreSQL 12, MSSQL 2012 #27337

Well, not for 1.21/1.20 .... but MSSQL 2008 is quite too old .... https://endoflife.date/mssqlserver , so it's still better to upgrade the database .....

image

@lunny lunny added issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail and removed type/bug labels Nov 28, 2023
@GiteaBot
Copy link
Contributor

We close issues that need feedback from the author if there were no new comments for a month. 🍵

@snoopydo
Copy link
Author

Documentation needs fixing.

https://docs.gitea.com/installation/database-prep

@wxiaoguang
Copy link
Contributor

-> Improve 1.22 document for Database Preparation #28643
-> Improve 1.21 document for Database Preparation (#28643) #28644

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants