Created
December 19, 2018 21:23
-
-
Save bradfordcondon/e9d6e77c327cedbea17206ca3bd42618 to your computer and use it in GitHub Desktop.
rebuild drupal database (developer)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
DB_NAME="drupal" | |
DB_PASS="secret" | |
DB_USER="drupal" | |
ADMIN_PASS=secret | |
echo "Dropping DB: $DB_NAME" | |
sudo -u postgres dropdb $DB_NAME | |
if [ $? -eq 0 ]; then | |
echo "DB Dropped" | |
else | |
echo "Was not able to drop the DB" | |
exit 1 | |
fi | |
echo "Recreating DB" | |
sudo -u postgres createdb $DB_NAME -O $DB_USER | |
if [ $? -eq 0 ]; then | |
echo "DB Created" | |
else | |
echo "Was not able to create the DB" | |
exit 1 | |
fi | |
echo "Copying settings" | |
sudo cp sites/default/default.settings.php sites/default/settings.php | |
if [ $? -eq 0 ]; then | |
echo "Settings Copied" | |
else | |
echo "Was not able to copy the settings" | |
exit 1 | |
fi | |
echo "Installing Drupal" | |
drush si --db-url=pgsql://$DB_USER:$DB_PASS@127.0.0.1/$DB_NAME --account-pass=secret -y | |
if [ $? -eq 0 ]; then | |
echo "Drupal Installed" | |
else | |
echo "Was not able to install drupal" | |
exit 1 | |
fi | |
echo "Installing Tripal" | |
drush en -y tripal tripal_chado tripal_chado_views tripal_ds tripal_ws \ | |
&& drush eval "module_load_include('inc', 'tripal_chado', 'includes/tripal_chado.install'); tripal_chado_load_drush_submit('Install Chado v1.3');" \ | |
&& drush trp-run-jobs --username=admin \ | |
&& drush eval "module_load_include('inc', 'tripal_chado', 'includes/setup/tripal_chado.setup'); tripal_chado_prepare_drush_submit();" \ | |
&& drush trp-run-jobs --username=admin \ | |
&& drush dis -y overlay | |
if [ $? -eq 0 ]; then | |
echo "Success! Your site has been reset." | |
else | |
echo "Error! Unable to reset site. See above for errors." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment