FILES needed:
------------
- update_barcode_se.py
- update_barcode_mpa.py
- update_ism_plans.py
- guez_db_ism_save_barcodes.sql

STOP SV
-------

BEFORE importing new buildings:
------------------------------
As user postgres in EXCDBS01, go to /opt/postgres/backup/

0. BACKUP ISM
   pg_dump -n ism -a lts_ets_pro > ism.dump
   or DB, z.B.
   pg_dump lts_ets_pro > lts_ets_pro_2021_08_30.dump

1. SAVE BARCODES:
psql lts_ets_pro -f guez_db_ism_save_barcodes.sql

An overview with all buildings ans barcodes is in 
/opt/postgres/backup/ism_view_buildings.csv

2. GENERATE UPDATE BARCODES SQL
Go to /opt/postgres/backup/ and run these scripts:
./update_barcode_se.py  ism_se_barcodes.csv  update_ism_barcodes_se.sql
./update_barcode_mpa.py ism_mpa_barcodes.csv update_ism_barcodes_mpa.sql
./update_ism_plans.py   ism_view_plans.csv   update_ism_plans.sql

START SV
--------

3. IMPORT BUILDINGS (first delete all, then import new with SV running)

AFTER Importing new Buildings
-----------------------------

4. IMPORT RUAG CSV from MMI

5. RESTORE BARCODES
psql lts_ets_pro -f update_ism_barcodes_se.sql
psql lts_ets_pro -f update_ism_barcodes_mpa.sql
psql lts_ets_pro -f update_ism_plans.sql

6. REMOVE EMPTY RECORED
psql lts_ets_pro -c "delete from ism.ism_mounting_point_asset where asset_id is null or structure_element_id is null;"
psql lts_ets_pro -c "delete from ism.ism_mounting_point_plan where structure_element_id is null;"


RESTART SV
----------

