#!/bin/bash

# if not $1 then exit; it should be the type ; 
if [[ -z "$1" ]]; then
    echo "First argument should be the RECO_TYPE (logo/med). Exiting..."
    exit 1
fi

RECO_TYPE_CLOUD="reco-${1}"

# run migrations
docker exec ${RECO_TYPE_CLOUD}-php1 bash -c "cd /var/www/html/recomedcloud && php index.php partner/cli_migrate" > /tmp/migrations.log 2>&1
echo "Exit status: $?" >> /tmp/migrations.log

cat /tmp/migrations.log