#!/bin/sh
export PGPASSWORD=PYnuOIXNbkVOvdTL
P="psql -h 127.0.0.1 -U bgar1_delta_com -d bgar1_delta_com_ingredi"
echo "== mail/smtp/ldap vars"
$P -tA -c "select 'fixed:'||variable||'='||coalesce(value,'') from fixed_config where variable ~* 'mail|smtp|ldap|auth|sso|saml|api|proxy|domain' union all select 'user:'||variable||'='||coalesce(value,'') from user_config where variable ~* 'mail|smtp|ldap|auth|sso|saml|api|proxy|domain' union all select 'site:'||variable||'='||coalesce(value,'') from public_site_config where variable ~* 'mail|smtp|ldap|auth|sso|saml|api|proxy|domain'" 2>&1 | cut -c1-200 | head -80
echo "== users count/columns"
$P -tA -c "select count(*) from users"
$P -tA -c "select column_name from information_schema.columns where table_name='users' order by ordinal_position" | tr '\n' ' '
echo
echo "== users sample"
$P -tA -F' | ' -c "select id,username,first_name,last_name,email,admin,disabled,last_login,created from users order by id limit 15" 2>&1 | cut -c1-220
