Sha256: 0a6f961af0f57da532a45cf228534ef2d4475151dd36aca6a6e1f45f4eff6032

Contents?: true

Size: 1.82 KB

Versions: 15

Compression:

Stored size: 1.82 KB

Contents

#!/usr/bin/env bash

set -e

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

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

  base=$(script_dir)

  echo "» message type"
  psql $database -q -f $base/types/message.sql
}

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

  base=$(script_dir)

  echo "» message_store_version function"
  psql $database -q -f $base/functions/message-store-version.sql

  echo "» hash_64 function"
  psql $database -q -f $base/functions/hash-64.sql

  echo "» acquire_lock function"
  psql $database -q -f $base/functions/acquire-lock.sql

  echo "» category function"
  psql $database -q -f $base/functions/category.sql

  echo "» is_category function"
  psql $database -q -f $base/functions/is-category.sql

  echo "» id function"
  psql $database -q -f $base/functions/id.sql

  echo "» cardinal_id function"
  psql $database -q -f $base/functions/cardinal-id.sql

  echo "» stream_version function"
  psql $database -q -f $base/functions/stream-version.sql

  echo "» write_message function"
  psql $database -q -f $base/functions/write-message.sql

  echo "» get_stream_messages function"
  psql $database -q -f $base/functions/get-stream-messages.sql

  echo "» get_category_messages function"
  psql $database -q -f $base/functions/get-category-messages.sql

  echo "» get_last_stream_message function"
  psql $database -q -f $base/functions/get-last-stream-message.sql
}

echo "Creating Types"
echo "- - -"
create-types
echo

echo "Creating Functions"
echo "- - -"
create-functions
echo

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
message-db-2.1.6 database/install-functions.sh
message-db-2.1.5 database/install-functions.sh
message-db-2.1.4 database/install-functions.sh
message-db-2.1.3 database/install-functions.sh
message-db-2.1.2 database/install-functions.sh
message-db-2.1.1 database/install-functions.sh
message-db-2.1.0 database/install-functions.sh
message-db-2.0.2 database/install-functions.sh
message-db-2.0.1 database/install-functions.sh
message-db-2.0.0 database/install-functions.sh
message-db-1.1.3 database/install-functions.sh
message-db-1.1.2 database/install-functions.sh
message-db-1.1.1 database/install-functions.sh
message-db-1.1.0 database/install-functions.sh
message-db-1.0.0 database/install-functions.sh