Skip to content

Instantly share code, notes, and snippets.

@MarceloHoffmeister
Last active August 24, 2021 12:53
Show Gist options
  • Save MarceloHoffmeister/13acc0e91090361224d97bfbbc6b38e0 to your computer and use it in GitHub Desktop.
Save MarceloHoffmeister/13acc0e91090361224d97bfbbc6b38e0 to your computer and use it in GitHub Desktop.
Postgres utils
### find sequence
SELECT c.relname FROM pg_class c WHERE c.relkind = 'S' and relname ilike '%db_usuarios%';
### set next sequence
select nextval('db_usuarios_id_usuario_seq');
### show current sequence
select last_value from db_usuarios_id_usuario_seq;
select currval('db_usuarios_id_usuario_seq');
### copiar arquivo de backup para dentro da imagem ecidade
docker cp /home/hoffmeister/ladario_bkp.pgbkp e-cidade:/home/
### restaura arquivo backup no banco ecidade
pg_restore --dbname=ecidade --verbose /home/ladario_bkp.pgbkp
### alterar senha usuário para "237259"
UPDATE configuracoes.db_usuarios SET senha='58c3310b310a678be91369fcca3d9f97b4fd4222' WHERE login='willian';
### iniciar servidor Postgres dentro da imagem ecidade
docker exec e-cidade service postgresql start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment