Skip to content

Add minimum versions of databases to the docs #17080

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

Merged
merged 1 commit into from
Sep 17, 2021

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Sep 17, 2021

We do not currently state the minimum versions of databases we support.

This PR sets them to:

  • MySQL >=5.7
  • Postgres >=10
  • MSSQL >=2008R2 SP3

Reference #17067

Signed-off-by: Andrew Thornton [email protected]

We do not currently state the minimum versions of databases we support.

This PR sets them to:
* MySQL >=5.7
* Postgres >=10
* MSSQL >=2008R2 SP3

Signed-off-by: Andrew Thornton <[email protected]>
@zeripath zeripath added the type/docs This PR mainly updates/creates documentation label Sep 17, 2021
@zeripath zeripath added this to the 1.16.0 milestone Sep 17, 2021
@zeripath
Copy link
Contributor Author

zeripath commented Sep 17, 2021

Now whilst checking the postgres db version is kinda easy the rest are not so, so I'm not proposing adding the additional code to check the minimum version. Although the below would do it for postgres

func checkDBVersion(e *xorm.Engine) {
	switch {
	case setting.Database.UsePostgreSQL:
		var versionString string
		if _, err := e.SQL("SELECT current_setting('server_version_num')").Get(&versionString); err != nil {
			log.Critical("Unable to check version of Postgres. This version of Postges may be unsupported. Error: %v", err)
			return
		}
		version, err := strconv.Atoi(versionString)
		if err != nil {
			log.Critical("Unexpected DB version: %s which is not an integer. This version of Postgres may be unsupported.", versionString)
			return
		}
		if version < 100000 {
			log.Critical("This version (%s) of Postgres is unsupported. Upgrade your database.", versionString)
			return
		}
	}
}

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 17, 2021
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Sep 17, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Sep 17, 2021
@zeripath zeripath merged commit ba2e600 into go-gitea:main Sep 17, 2021
@zeripath zeripath deleted the set-min-db-docs branch September 17, 2021 22:25
@lunny
Copy link
Member

lunny commented Sep 18, 2021

Now whilst checking the postgres db version is kinda easy the rest are not so, so I'm not proposing adding the additional code to check the minimum version. Although the below would do it for postgres

func checkDBVersion(e *xorm.Engine) {
	switch {
	case setting.Database.UsePostgreSQL:
		var versionString string
		if _, err := e.SQL("SELECT current_setting('server_version_num')").Get(&versionString); err != nil {
			log.Critical("Unable to check version of Postgres. This version of Postges may be unsupported. Error: %v", err)
			return
		}
		version, err := strconv.Atoi(versionString)
		if err != nil {
			log.Critical("Unexpected DB version: %s which is not an integer. This version of Postgres may be unsupported.", versionString)
			return
		}
		if version < 100000 {
			log.Critical("This version (%s) of Postgres is unsupported. Upgrade your database.", versionString)
			return
		}
	}
}

xorm v1.2.3 has supports to get DB version.

@zeripath
Copy link
Contributor Author

xorm v1.2.3 has supports to get DB version.

ah but MariaDB and MySQL both do interesting things with their version numbers

@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/docs This PR mainly updates/creates documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants