Sha256: 645a301d9d03ceef6a3965562d5c320dbd7a7e392ea6b306dc91cae7cb344bf2

Contents?: true

Size: 1.01 KB

Versions: 15

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env bash

set -e

echo

default_name=message_store

if [ -z ${DATABASE_USER+x} ]; then
  echo "(DATABASE_USER is not set)"
  user=$default_name
else
  user=$DATABASE_USER
fi
echo "Database user is: $user"

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

if [ -z ${CATEGORY+x} ]; then
  echo "(CATEGORY is not set)"
  category=''
else
  category=$CATEGORY
  echo "Category is: $CATEGORY"
fi

echo
echo "Category Type Summary"
echo "= = ="
echo

if [ -z $category ]; then
  psql $database -U $user -P pager=off -c "SELECT * FROM category_type_summary;"
  psql $database -U $user -P pager=off -c "SELECT COUNT(*) AS total_count FROM messages;"
else
  psql $database -U $user -P pager=off -c "SELECT * FROM category_type_summary WHERE category LIKE '%$category%';"
  psql $database -U $user -P pager=off -c "SELECT COUNT(*) AS total_count FROM messages WHERE category(stream_name) LIKE '%$category%';"
fi

Version data entries

15 entries across 15 versions & 1 rubygems

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