#!/bin/bash
set -euo pipefail

sudo apt -qq install -y libgraphviz-dev &> /dev/null

pip --disable-pip-version-check \
  install \
  --quiet \
  --global-option=build_ext \
  --global-option="-I/usr/local/Cellar/graphviz/2.38.0/include/"  \
  --global-option="-L/usr/local/Cellar/graphviz/2.38.0/lib/" \
  pygraphviz eralchemy &> /dev/null

eralchemy -i \
  postgresql://health_api:health_api@localhost:5432/health_api \
  -o /tmp/health_api_erd.png & > /dev/null

echo "file output at /tmp/health_api_erd.png"
