# Database Administration Tools

# Command Line Tools

The Eventide message store Postgres database package installs command line tools for administering the database.

TIP

If you installed the tools via Bundler, prefix the following commands with bundle exec, for example: bundle exec mdb-create-db

Note: The message_store_postgres.json settings file does not configure the connection used for any database administrative tasks, including creating the message store schema or printing reports. The administrative connection is controlled by the facilities provided by Postgres itself. For more details, see: https://www.postgresql.org/docs/current/libpq-envars.html.

# Database Schema Tools

# Install the Message Store Database

mdb-create-db

# Delete the Message Store Database

mdb-delete-db

# Recreate the Message Store Database

mdb-recreate-db

# Clear the Messages from the Message Store Database

mdb-clear-messages

# Database Schema Update Tools

The schema update tools are useful when upgrading to a new release of the message store database.

# Update the Database

mdb-update-db

This tool installs the functions, indexes, views, and privileges.

If any function, index, view, or privilege already exists, it will be replaced with the most recent definition. If any of these does not exist, they will be created.

# Install Functions

mdb-install-functions

# Install Indexes

mdb-install-indexes

# Install Views

mdb-install-views

# Install Privileges

mdb-install-privileges

# Reporting

mdb-print-messages

Print Messages from a Specific Stream

STREAM_NAME=someStream mdb-print-messages
mdb-print-stream-summary

Print Stream Summary Statistics for a Stream Name

STREAM_NAME=someStream mdb-print-stream-summary

NOTE: The stream name is matched by substring using a SQL LIKE clause

mdb-print-type-summary

Print Type Summary Statistics for a Type Name

TYPE=SomeType mdb-print-type-summary

NOTE: The type name is matched by substring using a SQL LIKE clause

mdb-print-stream-type-summary

Print Stream and Type Summary Statistics for a Stream Name

STREAM_NAME=someStream mdb-print-stream-type-summary

NOTE: The stream name is matched by substring using a SQL LIKE clause

mdb-print-category-type-summary

Print Category and Type Summary Statistics for a Category

CATEGORY=someCategory mdb-print-category-type-summary

NOTE: The category name is matched by substring using a SQL LIKE clause

mdb-print-type-stream-summary

Print Type and Stream Summary Statistics for a Type Name

TYPE=SomeType mdb-print-type-stream-summary

NOTE: The type is matched by substring using a SQL LIKE clause

mdb-print-type-category-summary

Print Type and Category Summary Statistics for a Type Name

TYPE=SomeType mdb-print-type-category-summary

NOTE: The type is matched by substring using a SQL LIKE clause

# Other Tools

# Write a Test Message

mdb-write-test-message

The number of messages and the stream name can be specified using environment variables.

Write a test messages to a stream named someStream-111

STREAM_NAME=someStream-111 mdb-write-test-message

Write 10 test messages

INSTANCES=10 mdb-write-test-message

Write 10 test messages to a stream named someStream-111

STREAM_NAME=someStream-111 INSTANCES=10 mdb-write-test-message

# Open/View the Directory Containing the Database Definition Script Files

mdb-open-database-scripts-dir
mdb-print-message-store-version

NOTE: The message store includes a server function named message_store_version that reports the version of the database schema.

# Use an Alternate Database Name

The database administration tools presume a database named message_store.

If you prefer a different database name, you can specify it on the command line using environment variables:

DATABASE_NAME=some_other_database mdb-create-db