\pset tuples_only on
\pset format unaligned
BEGIN READ ONLY;
select 'tables|' || string_agg(table_name, ',' order by table_name)
from information_schema.tables
where table_schema='public'
  and table_type='BASE TABLE'
  and (table_name ilike '%account%' or table_name ilike '%group%' or table_name ilike '%api_key%' or table_name in ('users'));
select 'accounts_columns|' || string_agg(column_name || ':' || data_type, ',' order by ordinal_position) from information_schema.columns where table_schema='public' and table_name='accounts';
select 'upstream_accounts_columns|' || string_agg(column_name || ':' || data_type, ',' order by ordinal_position) from information_schema.columns where table_schema='public' and table_name='upstream_accounts';
select 'groups_columns|' || string_agg(column_name || ':' || data_type, ',' order by ordinal_position) from information_schema.columns where table_schema='public' and table_name='groups';
select 'api_keys_columns|' || string_agg(column_name || ':' || data_type, ',' order by ordinal_position) from information_schema.columns where table_schema='public' and table_name='api_keys';
select 'users_columns|' || string_agg(column_name || ':' || data_type, ',' order by ordinal_position) from information_schema.columns where table_schema='public' and table_name='users';
COMMIT;
