{% include "edxapp_common.j2" %}

if [[ -z "$NO_EDXAPP_SUDO" ]]; then
    SUDO='sudo -E -u {{ edxapp_user }} env "PATH=$PATH"'
fi

{% for db in lms_auth_config.DATABASES.keys() %}
  {%- if db != 'read_replica' %}
$SUDO {{ edxapp_venv_bin}}/python manage.py lms migrate --database {{ db }} --noinput --settings $EDX_PLATFORM_SETTINGS $@
  {% endif %}
{% endfor %}
