You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
855 B

  1. #!/bin/bash
  2. . lib/common
  3. set -e
  4. DBNAME="$(relation-get dbname)" || exit 1
  5. initing="${GOGOCARTO_CODE}"/.initing-${DBNAME}
  6. if [ -e "$initing" ]; then
  7. exit 0
  8. fi
  9. inited="${GOGOCARTO_CODE}"/.inited-${DBNAME}
  10. MONGO_URL=mongodb://${TARGET_SERVICE_NAME}:27017/${DBNAME}
  11. cat <<EOF >> ${GOGOCARTO_CODE}/.env
  12. ###> doctrine/mongodb-odm-bundle ###
  13. MONGODB_URL=$MONGO_URL
  14. ###< doctrine/mongodb-odm-bundle ###
  15. EOF
  16. if [ -e "$inited" ]; then
  17. exit 0
  18. fi
  19. ## came from ``Makefile`` in git's gogocarto source code. Target load-fixtures.
  20. touch "$initing"
  21. trap_add EXIT,ERR "rm -v \"$initing\""
  22. symphony doctrine:mongodb:schema:create &&
  23. symphony doctrine:mongodb:generate:hydrators &&
  24. symphony doctrine:mongodb:generate:proxies &&
  25. symphony doctrine:mongodb:fixtures:load -n || {
  26. err "Mongo database initialization failed."
  27. exit 1
  28. }
  29. touch "$inited"