update-db.sh 551 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. #
  3. set -e # Exit immediately if any command exits with a non-zero status
  4. activate_venv() {
  5. source env/bin/activate
  6. }
  7. update_db() { # Create the database. This also populates it with some goals and votes from the default rewards.py
  8. export FLASK_APP=ownchatbot
  9. if python -m flask update-db; then
  10. echo "Database updated successfully."
  11. else
  12. echo "Failed to update the database. Please check for errors."
  13. exit 1 # Exit the script with a non-zero status
  14. fi
  15. }
  16. activate_venv
  17. update_db
  18. deactivate