# Database Administration Tools
# Command Line Tools
The Eventide message store Postgres database package installs command line tools for administering the database.
- mdb-create-db
- mdb-delete-db
- mdb-recreate-db
- mdb-clear-messages
- mdb-update-db
- mdb-install-functions
- mdb-install-indexes
- mdb-install-views
- mdb-install-privileges
- mdb-print-messages
- mdb-print-stream-summary
- mdb-print-type-summary
- mdb-print-stream-type-summary
- mdb-print-category-type-summary
- mdb-print-type-stream-summary
- mdb-print-type-category-summary
- mdb-write-test-message
- mdb-open-database-scripts-dir
- mdb-print-message-store-version
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
# Print the Messages Stored the Message Store Database
mdb-print-messages
Print Messages from a Specific Stream
STREAM_NAME=someStream mdb-print-messages
# Print Summary Statistics by Stream Name
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
# Print Summary Statistics by Message Type
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
# Print Summary Statistics by Stream Name, Cross-Referenced by Message Type
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
# Print Summary Statistics by Category, Cross-Referenced by Message Type
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
# Print Summary Statistics by Message Type, Cross-Referenced by Stream Name
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
# Print Summary Statistics by Message Type, Cross-Referenced by Category
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
# Print the Message Store Database Schema Version
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