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.
33 lines
1.1 KiB
33 lines
1.1 KiB
#!/bin/bash
|
|
|
|
### DO NOT EDIT THIS FILE
|
|
|
|
source "$(dirname "${BASH_SOURCE[0]}")/../includes/includes.sh"
|
|
app_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." &> /dev/null && pwd)
|
|
source "$app_dir/etc/config.sh"
|
|
|
|
usage="Usage: make_local_database.sh [live|stage]"
|
|
env=$(getArgument "$1" "$usage" "live stage")
|
|
local_database_name=$(eval "echo \"\$local_${env}_database_name\"")
|
|
|
|
echo
|
|
echoMainTitle "Make Local Database"
|
|
|
|
echo
|
|
echo "Perform Database Changes ..."
|
|
|
|
live_urls=$(eval "echo \"\$${env}_to_local_${env}_urls\"")
|
|
local_urls=$(eval "echo \"\$${env}_to_local_local_urls\"")
|
|
for i in "${!live_urls[@]}"
|
|
do
|
|
mysql --defaults-extra-file="$app_dir/etc/local.my.cnf" -D "$local_database_name" -e \
|
|
"UPDATE sales_channel_domain SET url = '${local_urls[$i]}' WHERE url = '${live_urls[$i]}'"
|
|
done
|
|
|
|
script="$(eval "echo \"$app_dir/git/$project_name\$local_${env}_slug/bin/console\"")"
|
|
|
|
"$script" user:create -a --email="$local_shopware_email" --firstName="$local_shopware_firstname" --lastName="$local_shopware_lastname" "$local_shopware_user"
|
|
|
|
postScript "$app_dir/bin/postscripts/make_local_database.sh"
|
|
|
|
echo
|