Estaba en medio de cosas y movi archivos
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
This commit is contained in:
31
migrate.sh
31
migrate.sh
@@ -1,17 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Ask for password
|
||||
printf "Pass: "
|
||||
stty_orig=`stty -g` # save original terminal setting
|
||||
stty -echo # turn-off echoing.
|
||||
read PASS # read the password
|
||||
stty $stty_orig # restore terminal setting.
|
||||
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
|
||||
|
||||
echo "Ejecutando create.sql"
|
||||
mysql -u root -p$PASS biblioteca < create.sql
|
||||
printf "Eliminando: %s \n" "$1"
|
||||
mysql -u root -p"${PASS}" -e "DROP DATABASE $1"
|
||||
|
||||
echo "Ejecutando data.sql"
|
||||
mysql -u root -p$PASS biblioteca < data.sql
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user