Sha256: 0623db525285e8410c2bb65da2fdbbd1a362b7b02c270c3838edc181aa0e39b9

Contents?: true

Size: 709 Bytes

Versions: 1

Compression:

Stored size: 709 Bytes

Contents

#!/usr/bin/env bash

set -e

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

function run_psql_file {
  psql $database -q -v ON_ERROR_STOP=1 -f "$1"
}

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

function create-indexes {
  base=$(script_dir)

  echo "» messages_id index"
  run_psql_file $base/indexes/messages-id.sql

  echo "» messages_stream index"
  run_psql_file $base/indexes/messages-stream.sql

  echo "» messages_category index"
  run_psql_file $base/indexes/messages-category.sql
}

echo "Creating Indexes"
echo "- - -"
create-indexes
echo

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
message-db-3.0.0 database/install-indexes.sh