Sha256: 87cfa428e8344473736c49828e5f79abe68af12461d36521fb89bb2542d39402

Contents?: true

Size: 1018 Bytes

Versions: 2

Compression:

Stored size: 1018 Bytes

Contents

#!/usr/bin/env bash

set -e

function script_dir {
  val="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  echo "$val"
}

base=$(script_dir)

echo
echo "Uninstalling Database"
echo "Version: $(cat $base/VERSION.txt)"
echo "= = ="

if [ -z ${DATABASE_NAME+x} ]; then
  database=message_store
  echo "DATABASE_NAME is not set. Using: $database."
else
  database=$DATABASE_NAME
fi
echo

if [ -z ${PGOPTIONS+x} ]; then
  export PGOPTIONS='-c client_min_messages=warning'
fi

function delete-user {
  echo "» message_store user"
  psql postgres -P pager=off -q -c "DROP OWNED BY message_store;"
  psql postgres -P pager=off -q -c "DROP ROLE IF EXISTS message_store;"
}

function delete-database {
  echo "» $database database"
  psql postgres -P pager=off -q -c "DROP DATABASE IF EXISTS $database;"
}

echo "Deleting database"
echo "- - -"
delete-database
echo

echo "Deleting database user"
echo "- - -"
delete-user

echo

echo "= = ="
echo "Done Uninstalling Database"
echo "Version: $(cat $base/VERSION.txt)"
echo

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
message-db-2.1.0 database/uninstall.sh
message-db-2.0.2 database/uninstall.sh