qwat-data-model icon indicating copy to clipboard operation
qwat-data-model copied to clipboard

Restoring "data_only" dumps in raw 1.3.3 structure fails because of sigip customisazion

Open haubourg opened this issue 6 years ago • 6 comments

Hi, I'm initializing a 1.3.3 structure with the init scripts and then I restore the data only dump. It fails because the dump contains tables of the sigip module, which one only exists in travis tests :

Set baseline...OK
 *** QWAT was successfuly initialized! ***
----- starting qwat demo data restore --------------
pg_restore: [programme d'archivage (db)] Erreur pendant le traitement de la TOC (« PROCESSING TOC ») :
pg_restore: [programme d'archivage (db)] Erreur à partir de l'entrée TOC 4957 ; 0 46811 TABLE DATA damage postgres
pg_restore: [programme d'archivage (db)] could not execute query: ERROR:  relation "qwat_od.damage" does not exist
    La commande était : ALTER TABLE qwat_od.damage DISABLE TRIGGER ALL;


pg_restore: [programme d'archivage (db)] could not execute query: ERROR:  relation "damage" does not exist
    La commande était : COPY damage (id, fk_cause, fk_pipe, widespread_damage, detection_date, repair_date, _repaired, address, pipe_replaced, descr...
pg_restore: [programme d'archivage (db)] could not execute query: ERROR:  relation "qwat_od.damage" does not exist
    La commande était : ALTER TABLE qwat_od.damage ENABLE TRIGGER ALL;


pg_restore: [programme d'archivage (db)] Erreur à partir de l'entrée TOC 5070 ; 0 0 SEQUENCE SET damage_id_seq postgres
pg_restore: [programme d'archivage (db)] could not execute query: ERROR:  relation "damage_id_seq" does not exist
LIGNE 1 : SELECT pg_catalog.setval('damage_id_seq', 1, false);
                                   ^
    La commande était : SELECT pg_catalog.setval('damage_id_seq', 1, false);



pg_restore: [programme d'archivage (db)] Erreur pendant le traitement de la TOC (« PROCESSING TOC ») :
pg_restore: [programme d'archivage (db)] Erreur à partir de l'entrée TOC 4927 ; 0 18265 TABLE DATA network_element postgres
pg_restore: [programme d'archivage (db)] could not execute query: ERROR:  column "qwat_ext_ch_vd_sire_etat_exploitation" of relation "network_element" does not exist
    La commande était : COPY network_element (id, identification, fk_distributor, fk_status, fk_folder, fk_locationtype, fk_precision, fk_precisiona...
pg_restore: [programme d'archivage (db)] Erreur pendant le traitement de la TOC (« PROCESSING TOC ») :
pg_restore: [programme d'archivage (db)] Erreur à partir de l'entrée TOC 4931 ; 0 18291 TABLE DATA pipe postgres
pg_restore: [programme d'archivage (db)] could not execute query: ERROR:  column "qwat_ext_ch_vd_sire_etat_exploitation" of relation "pipe" does not exist
    La commande était : COPY pipe (id, fk_parent, fk_function, fk_installmethod, fk_material, fk_distributor, fk_precision, fk_bedding, fk_protectio...
pg_restore: [programme d'archivage (db)] Erreur à partir de l'entrée TOC 4951 ; 0 18382 TABLE DATA valve postgres
pg_restore: [programme d'archivage (db)] could not execute query: ERROR:  column "qwat_ext_ch_vd_sire_etat_exploitation" of relation "valve" does not exist
    La commande était : COPY valve (id, fk_valve_type, fk_valve_function, fk_valve_actuation, fk_pipe, fk_handle_precision, fk_handle_precisionalti,...
ATTENTION : erreurs ignorées lors de la restauration : 12

The travis deploy logic shouldn't dump the qwat_sigip schema any opinion @elemoine @lbartoletti ?

haubourg avatar Jan 24 '19 20:01 haubourg

Drop before dump or alter dump procedure indeed.

ponceta avatar Feb 26 '19 16:02 ponceta

I suggest creating a script that removes customization to restore the database to a "standard" state. This will call for drop_views.sql and a modification of qwat_od.damage.

Are you OK with that?

lbartoletti avatar Feb 27 '19 09:02 lbartoletti

@lbartoletti I let you decide with @haubourg and @elemoine what is the best way to proceed. I'm OK with any correction that makes the dump reliable for users.

ponceta avatar Feb 28 '19 07:02 ponceta

@lbartoletti +1

haubourg avatar Feb 28 '19 09:02 haubourg

I updated the dumps based on the model without the extensions.

lbartoletti avatar Apr 19 '19 04:04 lbartoletti

installing 1.3.6 leads me to the same error. After using the plain SQL file to restore the model, running drop_views.sql fails because of the sigip views.

3nids avatar Nov 14 '22 07:11 3nids

sigip views are yet not more referencing production views.

ponceta avatar Jan 13 '23 07:01 ponceta