GetDBCompressionCommand returns the appropriate database compression command based on the database type and version.
()
| 847 | // GetDBCompressionCommand returns the appropriate database compression command |
| 848 | // based on the database type and version. |
| 849 | func (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. |
no test coverage detected