Estoy avanzando a la venta, pero se me ocurrio mover unos archivos porque.... puedo? Me molestaba tanta cosa en el index XD aparte mejore el migrate.sh y cree un dump.sh para mas comodidad de exportar los cambios a la base de datos
29 lines
634 B
Bash
Executable File
29 lines
634 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if [ -z "$1" ]; then
|
|
echo "Se debe pasar el nombre de la base de datos"
|
|
exit 1
|
|
fi
|
|
|
|
printf "Enter password: "
|
|
stty_orig=$(stty -g) # save original terminal setting
|
|
stty -echo # turn-off echoing.
|
|
read -r PASS # read the password
|
|
stty "${stty_orig}" # restore terminal setting.
|
|
echo ""
|
|
|
|
|
|
set -e
|
|
|
|
printf "Eliminando: %s \n" "$1"
|
|
mysql -u root -p"${PASS}" -e "DROP DATABASE $1"
|
|
|
|
printf "Creando: %s \n" "$1"
|
|
mysql -u root -p"${PASS}" -e "CREATE DATABASE $1"
|
|
|
|
printf "Ejecutando: create.sql \n"
|
|
mysql -u root -p"${PASS}" "${1}" < db/create.sql
|
|
|
|
printf "Ejecutando: data.sql \n"
|
|
mysql -u root -p"${PASS}" "${1}" < db/data.sql
|