Skip to content

Commit

Permalink
feat: change database default to mariadb:10.11, fixes ddev#5797
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Feb 21, 2024
1 parent 18842b6 commit 42f56a4
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: callme10.11
type: php
docroot: ""
database:
type: "mariadb"
version: "10.11"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: callme10.8
type: php
docroot: ""
database:
type: "mariadb"
version: "10.8"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: imagespec10.11
type: php
docroot: ""
dbimage: somerandomdbimg-mariadb-10.11
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: imagespec10.7
name: imagespec10.8
type: php
docroot: ""
dbimage: somerandomdbimg-mariadb-10.7
dbimage: somerandomdbimg-mariadb-10.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: imagespec10.7
type: php
docroot: ""
dbimage: somerandomdbimg-mariadb-10.7
2 changes: 1 addition & 1 deletion docs/content/users/extend/database-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DDEV supports many versions of the MariaDB, MySQL, and PostgreSQL database servers.

The default database type is MariaDB, and the default version is currently 10.4, but you can use MariaDB versions 5.5-10.8 and 10.11, MySQL 5.5-8.0, and Postgres 9-16. (New LTS versions of each of these are typically added soon after release. The very old versions are kept for compatibility with older projects.)
The default database type is MariaDB, and the default version is currently 10.11, but you can use MariaDB versions 5.5-10.8 and 10.11, MySQL 5.5-8.0, and Postgres 9-16. (New LTS versions of each of these are typically added soon after release. The very old versions are kept for compatibility with older projects.)

You could set these using the [`ddev config`](../usage/commands.md#config) command like this:

Expand Down
2 changes: 1 addition & 1 deletion docs/content/users/usage/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Flags:
* `--composer-root`: Overrides the default Composer root directory for the web service.
* `--composer-root-default`: Unsets a web service Composer root directory override.
* `--composer-version`: Specify override for Composer version in the web container. This may be `""`, `"1"`, `"2"`, `"2.2"`, `"stable"`, `"preview"`, `"snapshot"`, or a specific version.
* `--database`: Specify the database type:version to use. Defaults to `mariadb:10.4`.
* `--database`: Specify the database type:version to use. Defaults to `mariadb:10.11`.
* `--db-image`: Sets the db container image.
* `--db-image-default`: Sets the default db container image for this DDEV version.
* `--db-working-dir`: Overrides the default working directory for the db service.
Expand Down
2 changes: 1 addition & 1 deletion pkg/ddevapp/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
)

// GetExistingDBType returns type/version like mariadb:10.4 or postgres:13 or "" if no existing volume
// GetExistingDBType returns type/version like mariadb:10.11 or postgres:13 or "" if no existing volume
// This has to make a Docker container run so is fairly costly.
func (app *DdevApp) GetExistingDBType() (string, error) {
_, out, err := dockerutil.RunSimpleContainer(versionconstants.BusyboxImage, "GetExistingDBType-"+app.Name+"-"+util.RandString(6), []string{"sh", "-c", "( test -f /var/tmp/mysql/db_mariadb_version.txt && cat /var/tmp/mysql/db_mariadb_version.txt ) || ( test -f /var/tmp/postgres/PG_VERSION && cat /var/tmp/postgres/PG_VERSION) || true"}, []string{}, []string{}, []string{app.GetMariaDBVolumeName() + ":/var/tmp/mysql", app.GetPostgresVolumeName() + ":/var/tmp/postgres"}, "", true, false, map[string]string{`com.ddev.site-name`: app.GetName()}, nil)
Expand Down
2 changes: 2 additions & 0 deletions pkg/ddevapp/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ func TestDBTypeVersionFromString(t *testing.T) {
"10.5": "mariadb:10.5",
"10.6": "mariadb:10.6",
"10.7": "mariadb:10.7",
"10.8": "mariadb:10.8",
"10.11": "mariadb:10.11",
"mariadb_10.2": "mariadb:10.2",
"mariadb_10.3": "mariadb:10.3",
"mysql_5.7": "mysql:5.7",
Expand Down
2 changes: 1 addition & 1 deletion pkg/ddevapp/ddevapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ func TestDdevAllDatabases(t *testing.T) {
dbVersions = nodeps.RemoveItemFromSlice(dbVersions, "postgres:9")
//Use a smaller list if GOTEST_SHORT
if os.Getenv("GOTEST_SHORT") != "" {
dbVersions = []string{"postgres:10", "postgres:14", "mariadb:10.3", "mariadb:10.4", "mariadb:10.11", "mysql:8.0", "mysql:5.7"}
dbVersions = []string{"postgres:14", "mariadb:10.4", "mariadb:10.11", "mysql:8.0", "mysql:5.7"}
t.Logf("Using limited set of database servers because GOTEST_SHORT is set (%v)", dbVersions)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/ddevapp/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ConfigInstructions = `
# database:
# type: <dbtype> # mysql, mariadb, postgres
# version: <version> # database version, like "10.4" or "8.0"
# version: <version> # database version, like "10.11" or "8.0"
# MariaDB versions can be 5.5-10.8 and 10.11, MySQL versions can be 5.5-8.0
# PostgreSQL versions can be 9-16.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

database:
type: mariadb
version: 10.4
version: 10.11
php_version: 8.0
performance_mode: "none"
webserver_type: apache-fpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
database:
type: "mariadb"
version: "10.11"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
database:
type: "mariadb"
version: "10.8"
2 changes: 1 addition & 1 deletion pkg/nodeps/mariadb_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package nodeps

// MariaDBDefaultVersion is the default MariaDB version
const MariaDBDefaultVersion = MariaDB104
const MariaDBDefaultVersion = MariaDB1011

// ValidMariaDBVersions is the versions of MariaDB that are valid
var ValidMariaDBVersions = map[string]bool{
Expand Down
2 changes: 1 addition & 1 deletion pkg/nodeps/mariadb_values_darwin_arm64.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package nodeps

// MariaDBDefaultVersion is the default MariaDB version
const MariaDBDefaultVersion = MariaDB104
const MariaDBDefaultVersion = MariaDB1011

// ValidMariaDBVersions is the versions of MariaDB that are valid
var ValidMariaDBVersions = map[string]bool{
Expand Down
2 changes: 1 addition & 1 deletion pkg/nodeps/mariadb_values_linux_arm64.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package nodeps

// MariaDBDefaultVersion is the default MariaDB version
const MariaDBDefaultVersion = MariaDB104
const MariaDBDefaultVersion = MariaDB1011

// ValidMariaDBVersions is the versions of MariaDB that are valid
var ValidMariaDBVersions = map[string]bool{
Expand Down

0 comments on commit 42f56a4

Please sign in to comment.