valentine94
10/15/2019 - 6:54 PM

Reinstall local site D8

#!/usr/bin/env bash

importDatabase() {
  echo -n "Importing database dump..."
  $(drush sql-connect) < ../dump.sql
  echo "Done!"
}
dropDatabase() {
  # 3 times to ignore possible errors.
  echo -n "Dropping database..."
  for i in 1 2 3
  do
    drush sql-drop --yes &> /dev/null
  done
  echo "Done!"
}
cacheRebuild() {
  drush cr &> /dev/null
}

# Drop existing database and import database dump.
dropDatabase && importDatabase
# Clear the caches.
cacheRebuild
# Perform update.php.
drush updb --yes && drush updb --yes
# Clear the caches.
cacheRebuild
# Import configuration.
drush config-import --yes
# Clear the caches.
cacheRebuild
# Run update.php again.
drush updb --yes
# Update admin password.
drush upwd admin admin
# Install devel.
drush en devel, kint, dblog --yes
# Clear the caches.
cacheRebuild
# Change devel's dumper to kint.
drush cset devel.settings devel_dumper kint --yes