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

50 рядки
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. # Reset the local "bubble" database
  6. #
  7. # Usage: reset_bubble_db [debug]
  8. #
  9. # debug : set this to 'debug' to enable debugging
  10. #
  11. SCRIPT="${0}"
  12. SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)"
  13. . "${SCRIPT_DIR}/bubble_common"
  14. DEBUG=${1}
  15. if [[ -n "${DEBUG}" && "${DEBUG}" == "debug" ]] ; then
  16. DEBUG=1
  17. else
  18. DEBUG=0
  19. fi
  20. BUBBLE_SERVER="$(cd ${SCRIPT_DIR}/../bubble-server && pwd)"
  21. if [[ ! -d "${BUBBLE_SERVER}" ]] ; then
  22. die "bubble-server dir not found: ${BUBBLE_SERVER}"
  23. fi
  24. BUBBLE_TARGET=${BUBBLE_SERVER}/target
  25. META_DIR="${BUBBLE_TARGET}/classes/META-INF/bubble/"
  26. mkdir -p "${META_DIR}" || die "Error creating META-INF dir: ${META_DIR}"
  27. SQL_DIR="${BUBBLE_SERVER}/target/classes/META-INF/"
  28. if [[ ! -d "${SQL_DIR}" ]] ; then
  29. die "config dir not found: ${SQL_DIR}"
  30. fi
  31. SQL_DIR="$(cd "${SQL_DIR}" && pwd)"
  32. if [[ ${DEBUG} -eq 1 ]] ; then
  33. cd "${SCRIPT_DIR}"/.. && \
  34. mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 -Xnoagent -Djava.compiler=NONE" \
  35. -Dtest=bubble.test.DbInit -Ddb.dump="${SQL_DIR}/bubble.sql" test \
  36. || exit 1
  37. else
  38. cd "${SCRIPT_DIR}"/.. && \
  39. mvn -Dtest=bubble.test.DbInit -Ddb.dump="${SQL_DIR}/bubble.sql" test || exit 1
  40. fi
  41. dropdb bubble ; createdb bubble && cat "${SQL_DIR}/bubble.sql" | psql bubble
  42. echo "Successfully initialized DB schema from: "
  43. echo "${SQL_DIR}/bubble.sql"