Skip to content
Snippets Groups Projects
Commit e2fc772f authored by ines mkacher's avatar ines mkacher
Browse files

Update bddcheck.md

parent 7669cf79
No related branches found
No related tags found
2 merge requests!14Mise à jour arborescence,!131.0
......@@ -43,6 +43,7 @@ ou
ou
Aller dans le repertoire :
```postgres
§ /usr/lib/postgresql# ls -ltr
total 4
......@@ -86,16 +87,6 @@ psql -U user database < name_file.sql
## Requêtes utiles
### Trouver les mails non envoyés
```psql
=# select alt_identifier from mlb_coll_ext where res_id in (select DISTINCT CAST(document->>'id' as int)
from emails where status = 'ERROR' and document->>'id' is not null);
```
```psql
select fulltext_result FROM res_letterbox where fulltex_result is not null
```
### Rechercher tous les courriers (les plus récents)
......@@ -114,25 +105,21 @@ ou
$ select * from res_letterbox where dest_user = ''le_id_de_l'utilisateur';
```
### Rechercher un user et le remplacer
### Trouver les mails non envoyés
```psql
$ update res_letterbox set dest_user = 'levillain' where dest_user = 'GUE';
=# select alt_identifier from mlb_coll_ext where res_id in (select DISTINCT CAST(document->>'id' as int)
from emails where status = 'ERROR' and document->>'id' is not null);
```
ou
```psql
$ update listinstance set item_id = 'levillain' where item_id = 'GUE';
select fulltext_result FROM res_letterbox where fulltex_result is not null
```
ou
```psql
$ select * from users where firstname ilike '%lanie%';
```
ou
### Rechercher un user
```psql
$ update users set status = 'DEL' where user_id = 'FERREIRA';
$ select * from users where firstname ilike '%lanie%';
```
### Rechercher les notifications de mail
......@@ -141,29 +128,16 @@ $ update users set status = 'DEL' where user_id = 'FERREIRA';
$ select * from notif_email_stack;
```
### Supprimer les dates d'execution pour pouvoir relancer les notifications
Afficher uniquement les informations utiles et en ordre descendant
```psql
$ update notif_email_stack set exec_date=NULL, exec_result='';
select email_stack_sid, recipient, subject, exec_date, exec_result from notif_email_stack order by exec_date desc;
```
### Remettre un utilisateur supprimé (de manière logique en actif)
Changer le statut d'un utilisateur via la BDD
Au statut OK
```psql
$ UPDATE public.users SET status='OK' WHERE user_id='bblier';
```
Au statut absent
```psql
$ UPDATE public.users SET status='ABS' WHERE user_id='bblier';
maarch=# select * from notif_email_stack order by email_stack_sid desc limit 5;
```
## Erreurs connues "Database connection failed"
Lors de la connection sur l'application vous avez ce message d'erreur :
......@@ -362,59 +336,7 @@ service apache2 status
```
## Commandes pour diagnostic des notifications de mails
```
maarch=# update notif_email_stack set exec_result = '' where email_stack_sid = 14158;
UPDATE 1
maarch=# update notif_email_stack set exec_date = null where email_stack_sid = 14158;
UPDATE 1
maarch=# select * from notif_email_stack order by email_stack_sid desc limit 5;
maarch=# update notif_email_stack set recipient = 'melissa.olive@maarchlesbains.fr' where email_stack_sid = 14158;
UPDATE 1
maarch=# update notif_email_stack set exec_date = null where email_stack_sid = 14158;
UPDATE 1
maarch=# update notif_email_stack set exec_result = '' where email_stack_sid = 14158;
UPDATE 1
maarch=# \q
```
```
maarch=# select * from notif_email_stack order by email_stack_sid desc limit 5;
maarch=# update notif_email_stack set exec_result = '' where email_stack_sid = 14158;
UPDATE 1
maarch=# update notif_email_stack set exec_date = null where email_stack_sid = 14158;
UPDATE 1
maarch=# update notif_email_stack set recipient = 'martine.trani@ville-agde.fr' where email_stack_sid = 14158;
UPDATE 1
maarch=# \q
```
```
maarch=# update notif_email_stack set exec_date = null where email_stack_sid = 14158;
UPDATE 1
maarch=# update notif_email_stack set exec_result = '' where email_stack_sid = 14158;
UPDATE 1
maarch=# update notif_email_stack set recipient = 'paul.bringe@maarchlesbains.fr' where email_stack_sid = 14158;
UPDATE 1
maarch=# select * from notif_email_stack order by email_stack_sid desc limit 5;
maarch=# \q
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment