Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
titleDBclear script
linenumberstrue
# script assumes that opennsa code is at /usr/src/opennsa 
# LOC1m LOC2 ... LOCn represents uPA instances for individual locations. Scripts assumes that aggregator instances is called "main"  
# the SQL file droptable.sql is needed at the same place as this script

cd /usr/src/opennsa
cp datafiles/schema.sql /tmp/
for l in LOC1 LOC2 main; do
        echo "Dropping tables from opennsa-$l"
        su - opennsa -c "
        psql opennsa-$l -c '\i ./droptables.sql'
        "
        su - opennsa -c "
        psql opennsa-$l -c '\i /tmp/schema.sql'
        "

done


for l in LOC1 LOC2 main; do
        /etc/init.d/opennsa-$l restart
        sleep 1
done


Code Block
languagesql
titledroptables.sql
linenumberstrue
-- OpenNSA SQL Schema (PostgreSQL)
-- consider some generic key-value thing for future usage
-- ALL timestamps must be in utc

drop table generic_backend_connections;
drop table sub_connections;
drop table service_connections;
drop type label;