Sha256: 1805997749c041cf91fb7902f2ed7962d62a29afce60bf10642f1c175213cb2e

Contents?: true

Size: 952 Bytes

Versions: 5

Compression:

Stored size: 952 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 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

5 entries across 5 versions & 1 rubygems

Version Path
message-db-2.1.5 database/uninstall.sh
message-db-2.1.4 database/uninstall.sh
message-db-2.1.3 database/uninstall.sh
message-db-2.1.2 database/uninstall.sh
message-db-2.1.1 database/uninstall.sh