File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ H2_VERSION=1.4.197
3+ DB_URL=jdbc:h2:file:./db/$H2_VERSION /keeptime-h2-db; DB_CLOSE_ON_EXIT=FALSE
4+ DB_USER=sa
5+ DB_PASSWD=
6+ SQL_BACKUP_FILENAME=KeepTime_database-export_H2-version-$H2_VERSION .sql
7+
8+ echo " Script to export the content of H2 databse from KeepTime version 1.2.0-SNAPSHOT to .sql file."
9+ echo " The script should be placed next to the .jar file."
10+ read -p " Press enter to continue"
11+
12+ echo -e " \nExtracting H2 driver from KeepTime .jar file."
13+ DRIVER_JAR_FROM_KEEPTIME=BOOT-INF/lib/h2-$H2_VERSION .jar
14+ jar xfv keeptime-1.2.0-SNAPSHOT.jar $DRIVER_JAR_FROM_KEEPTIME
15+
16+ echo -e " \nTriggering database backup."
17+ java -cp $DRIVER_JAR_FROM_KEEPTIME org.h2.tools.Script -url $DB_URL -user $DB_USER -script $SQL_BACKUP_FILENAME -options DROP
18+
19+ echo -e " \nCleanup of extracted .jar file."
20+ rm -rv BOOT-INF
21+
22+ echo -e " \nIf no error occured the export has succeeded."
23+ echo " The exported file was created at '$( pwd) /$SQL_BACKUP_FILENAME '."
24+ echo -e " \nYou can now import this file in a new version of KeepTime.\n"
25+
26+ read -p " All set. Press enter to exit script."
You can’t perform that action at this time.
0 commit comments