Add run db to connect to the database

This commit is contained in:
Oliver Davies 2024-07-20 13:52:19 +01:00
parent 937f8dce88
commit 97836712f2
2 changed files with 11 additions and 0 deletions

View file

@ -14,3 +14,7 @@ export DRUSH_OPTIONS_URI="https://${COMPOSE_PROJECT_NAME}.docker.localhost"
export MYSQL_DATABASE=app
export MYSQL_PASSWORD=app
export MYSQL_USER=app
export DB_NAME="$MYSQL_DATABASE"
export DB_PASSWORD="$MYSQL_PASSWORD"
export DB_USER="$MYSQL_USER"

View file

@ -53,6 +53,13 @@ function composer {
_exec php composer "${@}"
}
# Connect to the database.
function db {
[[ -f ".env" ]] && source .env
docker compose exec database mysql -u"$DB_USER" -p"$DB_PASSWORD" "$DB_NAME"
}
function drush {
_exec php drush "${@}"
}