diff --git a/continuousintegration/docker/ctafrontend/cc7/config/init/purge_database.ext b/continuousintegration/docker/ctafrontend/cc7/config/init/purge_database.ext new file mode 100644 index 0000000000000000000000000000000000000000..50ce0780aa57ca29fa8c3860d9196b247619211e --- /dev/null +++ b/continuousintegration/docker/ctafrontend/cc7/config/init/purge_database.ext @@ -0,0 +1,55 @@ +set LINESIZE 1000 +set pages 1000 +set serveroutput on size 30000; + +BEGIN + FOR cur_rec IN (SELECT object_name, object_type + FROM user_objects + WHERE object_type IN + ('TABLE', + 'VIEW', + 'MATERIALIZED VIEW', + 'PACKAGE', + 'PROCEDURE', + 'FUNCTION', + 'SEQUENCE', + 'SYNONYM', + 'PACKAGE BODY' + )) + LOOP + BEGIN + IF cur_rec.object_type = 'TABLE' + THEN + EXECUTE IMMEDIATE 'DROP ' + || cur_rec.object_type + || ' "' + || cur_rec.object_name + || '" CASCADE CONSTRAINTS'; + ELSE + EXECUTE IMMEDIATE 'DROP ' + || cur_rec.object_type + || ' "' + || cur_rec.object_name + || '"'; + END IF; + DBMS_OUTPUT.put_line ('WARNING: remaining ' + || cur_rec.object_type + || ' "' + || cur_rec.object_name + || '" just dropped' + ); + EXCEPTION + WHEN OTHERS + THEN + DBMS_OUTPUT.put_line ('FAILED: DROP ' + || cur_rec.object_type + || ' "' + || cur_rec.object_name + || '"' + ); + END; + END LOOP; +END; +/ + +quit; \ No newline at end of file diff --git a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/init.sh b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/init.sh index c7497f1bdb22431f8c6e7cb067405b4ac6be3d8d..b09d126c461c15db79493d70e4f14b3de4a69d40 100755 --- a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/init.sh +++ b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/init.sh @@ -67,6 +67,7 @@ if [ "$KEEP_DATABASE" == "0" ]; then echo "Purging Oracle recycle bin" test -f ${ORACLE_SQLPLUS} || echo "ERROR: ORACLE SQLPLUS client is not present, cannot purge recycle bin: ${ORACLE_SQLPLUS}" LD_LIBRARY_PATH=$(readlink ${ORACLE_SQLPLUS} | sed -e 's;/bin/[^/]\+;/lib;') ${ORACLE_SQLPLUS} $(echo $DATABASEURL | sed -e 's/oracle://') @/opt/ci/init/purge_recyclebin.ext + LD_LIBRARY_PATH=$(readlink ${ORACLE_SQLPLUS} | sed -e 's;/bin/[^/]\+;/lib;') ${ORACLE_SQLPLUS} $(echo $DATABASEURL | sed -e 's/oracle://') @/opt/ci/init/purge_database.ext cta-catalogue-schema-create /etc/cta/cta-catalogue.conf || die "ERROR: Could not create database schema. cta-catalogue-schema-create /etc/cta/cta-catalogue.conf FAILED" elif [ "$DATABASETYPE" == "postgres" ]; then cta-catalogue-schema-create /etc/cta/cta-catalogue.conf || die "ERROR: Could not create database schema. cta-catalogue-schema-create /etc/cta/cta-catalogue.conf FAILED"