Skip to content

Ensure setting.Database.UseXXX has been set to the right value when installing #23350

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

Closed
wants to merge 1 commit into from
Closed

Ensure setting.Database.UseXXX has been set to the right value when installing #23350

wants to merge 1 commit into from

Conversation

wolfogre
Copy link
Member

@wolfogre wolfogre commented Mar 7, 2023

setting.Database.Type has been modified, but setting.Database.UseXXX hasn't.

// Test database setting.
setting.Database.Type = form.DbType
setting.Database.Host = form.DbHost

So registerPostgresSchemaDriver will be missed when initing DB engine.

gitea/models/db/engine.go

Lines 104 to 110 in 84a2993

if setting.Database.UsePostgreSQL && len(setting.Database.Schema) > 0 {
// OK whilst we sort out our schema issues - create a schema aware postgres
registerPostgresSchemaDriver()
engine, err = xorm.NewEngine("postgresschema", connStr)
} else {
engine, err = xorm.NewEngine(setting.Database.Type, connStr)
}


BTW, I think it will be a good idea to refactor setting.Database.UseXXX to methods.

Update: #23354

Verified

This commit was signed with the committer’s verified signature.
wolfogre Jason Song
@wolfogre wolfogre added type/bug outdated/backport/v1.18 This PR should be backported to Gitea 1.18 outdated/backport/v1.19 This PR should be backported to Gitea 1.19 labels Mar 7, 2023
@wolfogre wolfogre added this to the 1.20.0 milestone Mar 7, 2023
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Mar 7, 2023
@wolfogre wolfogre marked this pull request as draft March 7, 2023 06:35
@wolfogre wolfogre closed this Mar 7, 2023
@lunny lunny removed this from the 1.20.0 milestone Mar 7, 2023
lunny pushed a commit that referenced this pull request Mar 7, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Replace #23350.

Refactor `setting.Database.UseMySQL` to
`setting.Database.Type.IsMySQL()`.

To avoid mismatching between `Type` and `UseXXX`.

This refactor can fix the bug mentioned in #23350, so it should be
backported.
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Mar 7, 2023

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
Replace go-gitea#23350.

Refactor `setting.Database.UseMySQL` to
`setting.Database.Type.IsMySQL()`.

To avoid mismatching between `Type` and `UseXXX`.

This refactor can fix the bug mentioned in go-gitea#23350, so it should be
backported.
lunny pushed a commit that referenced this pull request Mar 7, 2023

Partially verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
Backport #23354

Replace #23350.

Refactor `setting.Database.UseMySQL` to
`setting.Database.Type.IsMySQL()`.

To avoid mismatching between `Type` and `UseXXX`.

This refactor can fix the bug mentioned in #23350, so it should be
backported.

Co-authored-by: Jason Song <[email protected]>
@delvh delvh removed outdated/backport/v1.18 This PR should be backported to Gitea 1.18 outdated/backport/v1.19 This PR should be backported to Gitea 1.19 labels Mar 14, 2023
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 1 This PR needs approval from one additional maintainer to be merged. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants