Skip to content

Commit

Permalink
Make lando db-export use mariadb-dump, if it exists (#148)
Browse files Browse the repository at this point in the history
* Make `lando db-export` use mariadb-dump, if exists

`mysqldump` is deprecated in current versions of MariaDB, and generates a
deprecation warning. This change allows `db-export` to use `mariadb-dump`
if that command exists and the `MARIADB_DATABASE` env var is set.

Resolves lando/mariadb#47

* Fix typo in sql-export.sh comment

* Update CHANGELOG.

---------

Co-authored-by: Alec Reynolds <alec+git@lando.dev>
  • Loading branch information
christopher-b and reynoldsalec committed May 2, 2024
1 parent cba241d commit 63f32f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased

* Updated `sql-export.sh` to use `mariadb-dump` command (if available). [#148](https://github.com/lando/core/pull/148)

## v3.21.0-beta.18 - [April 29, 2024](https://github.com/lando/core/releases/tag/v3.21.0-beta.18)

* Fixed bug that prevented password prompts from rendering
Expand Down
4 changes: 3 additions & 1 deletion scripts/sql-export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ while (( "$#" )); do
esac
done

# Get type-specific dump cpmmand
# Get type-specific dump command
if [[ ${POSTGRES_DB} != '' ]]; then
DUMPER="pg_dump postgresql://$USER@localhost:$PORT/$DATABASE"
elif [[ ${MARIADB_DATABASE} != '' && -x $(command -v mariadb-dump) ]]; then
DUMPER="mariadb-dump --opt --user=${USER} --host=${HOST} --port=${PORT} ${LANDO_EXTRA_DB_EXPORT_ARGS} ${DATABASE}"
else
DUMPER="mysqldump --opt --user=${USER} --host=${HOST} --port=${PORT} ${LANDO_EXTRA_DB_EXPORT_ARGS} ${DATABASE}"
fi
Expand Down

0 comments on commit 63f32f5

Please sign in to comment.