Last active
December 4, 2018 07:52
-
-
Save torkildr/8e808c8d33bd5e5443d23a96cad28c89 to your computer and use it in GitHub Desktop.
psqlrc-file to clearly indicate difference between the staging and production postgres cluster instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- psqlrc to clearly indicate difference between the staging and production postgres cluster instance | |
SHOW cluster_name | |
\gset | |
SELECT | |
:'cluster_name' LIKE '%production%' AS is_production, | |
:'cluster_name' LIKE '%staging%' AS is_staging | |
\gset | |
\if :is_production | |
\set PROMPT1 '%[%033[1;93;41m%]%:cluster_name:%[%033[0m%] %n@%/%R%# ' | |
\elif :is_staging | |
\set PROMPT1 '%[%033[1;97;44m%]%:cluster_name:%[%033[0m%] %n@%/%R%# ' | |
\else | |
\set PROMPT1 '%:cluster_name: %n@%/%R%# ' | |
\endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment