MCPcopy Index your code
hub / github.com/ddev/ddev / GetDBCompressionCommand

Method GetDBCompressionCommand

pkg/ddevapp/ddevapp.go:849–865  ·  view source on GitHub ↗

GetDBCompressionCommand returns the appropriate database compression command based on the database type and version.

()

Source from the content-addressed store, hash-verified

847// GetDBCompressionCommand returns the appropriate database compression command
848// based on the database type and version.
849func (app *DdevApp) GetDBCompressionCommand() string {
850 if app.Database.Type == nodeps.Postgres {
851 if isOldPostgresDB, _ := util.SemverValidate("< 12", app.Database.Version); isOldPostgresDB {
852 return "zstd --quiet"
853 }
854 }
855 if app.Database.Type == nodeps.MySQL {
856 if isOldMysqlDB, _ := util.SemverValidate("< 8.0", app.Database.Version); isOldMysqlDB {
857 return "zstd --quiet"
858 }
859 }
860 // MariaDB 5.5 is based on Ubuntu 14.04 which lacks zstd support
861 if app.Database.Type == nodeps.MariaDB && app.Database.Version == nodeps.MariaDB55 {
862 return "gzip --quiet"
863 }
864 return "zstdmt --quiet"
865}
866
867// GetDBDumpCommand returns the appropriate database dump command (mysqldump or mariadb-dump)
868// based on the database type and version.

Callers 2

RestoreSnapshotMethod · 0.95
getBackupCommandFunction · 0.80

Calls 1

SemverValidateFunction · 0.92

Tested by

no test coverage detected