The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

51 рядки
1.5 KiB

  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
  4. #
  5. #
  6. # Reset the local "bubble" database
  7. #
  8. # Usage: reset_bubble_db [debug]
  9. #
  10. # debug : set this to 'debug' to enable debugging
  11. #
  12. SCRIPT="${0}"
  13. SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd)
  14. . ${SCRIPT_DIR}/bubble_common
  15. DEBUG=${1}
  16. if [[ ! -z "${DEBUG}" && "${DEBUG}" == "debug" ]] ; then
  17. DEBUG=1
  18. else
  19. DEBUG=0
  20. fi
  21. BUBBLE_SERVER="$(cd ${SCRIPT_DIR}/../bubble-server && pwd)"
  22. if [[ ! -d "${BUBBLE_SERVER}" ]] ; then
  23. die "bubble-server dir not found: ${BUBBLE_SERVER}"
  24. fi
  25. BUBBLE_TARGET=${BUBBLE_SERVER}/target
  26. META_DIR="${BUBBLE_TARGET}/classes/META-INF/bubble/"
  27. mkdir -p ${META_DIR} || die "Error creating META-INF dir: ${META_DIR}"
  28. SQL_DIR="${BUBBLE_SERVER}/target/classes/META-INF/"
  29. if [[ ! -d "${SQL_DIR}" ]] ; then
  30. die "config dir not found: ${SQL_DIR}"
  31. fi
  32. SQL_DIR="$(cd ${SQL_DIR} && pwd)"
  33. if [[ ${DEBUG} -eq 1 ]] ; then
  34. cd ${SCRIPT_DIR}/.. && \
  35. mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 -Xnoagent -Djava.compiler=NONE" \
  36. -Dtest=bubble.test.DbInit -Ddb.dump=${SQL_DIR}/bubble.sql test \
  37. || exit 1
  38. else
  39. cd ${SCRIPT_DIR}/.. && \
  40. mvn -Dtest=bubble.test.DbInit -Ddb.dump=${SQL_DIR}/bubble.sql test || exit 1
  41. fi
  42. dropdb bubble ; createdb bubble && cat ${SQL_DIR}/bubble.sql | psql bubble
  43. echo "Successfully initialized DB schema from: "
  44. echo ${SQL_DIR}/bubble.sql