Ein für Shopware 6 vorbereitet Systemmanagment.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.1 KiB

2 years ago
  1. #!/bin/bash
  2. source "$(dirname "${BASH_SOURCE[0]}")/../includes/includes.sh"
  3. app_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." &> /dev/null && pwd)
  4. source "$app_dir/etc/config.sh"
  5. usage="Usage: make_local_database.sh [live|stage]"
  6. env=$(getArgument "$1" "$usage" "live stage")
  7. local_database_name=$(eval "echo \"\$local_${env}_database_name\"")
  8. echo
  9. echoMainTitle "Make Local Database"
  10. echo
  11. echo "Perform Database Changes ..."
  12. live_urls=$(eval "echo \"\$${env}_to_local_${env}_urls\"")
  13. local_urls=$(eval "echo \"\$${env}_to_local_local_urls\"")
  14. for i in "${!live_urls[@]}"
  15. do
  16. mysql --defaults-extra-file="$app_dir/etc/local.my.cnf" -D "$local_database_name" -e \
  17. "UPDATE sales_channel_domain SET url = '${local_urls[$i]}' WHERE url = '${live_urls[$i]}'"
  18. done
  19. script="$(eval "echo \"$app_dir/git/$project_name\$local_${env}_slug/bin/console\"")"
  20. "$script" user:create -a --email="$local_shopware_email" --firstName="$local_shopware_firstname" --lastName="$local_shopware_lastname" "$local_shopware_user"
  21. postScript "$app_dir/bin/postscripts/make_local_database.sh"
  22. echo