Last active
December 28, 2022 08:30
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # h2-1.4.200.jar and h2-2.1.214.jar files must be present in the current working directory. | |
| # They can be found respectively in 6.2.26 and 6.2.27 Magnolia webapps | |
| path=/path/to/webapps/magnoliaAuthor/repositories/magnolia #repeat on public | |
| for filepath in $(find $path -name '*.mv.db'); do | |
| parentdir="$(dirname "$filepath")" | |
| # Export data from old db file to backup.zip | |
| echo "Exporting database $parentdir/db..." | |
| java -cp h2-1.4.200.jar org.h2.tools.Script -url jdbc:h2:$parentdir/db -script $parentdir/backup.zip -options compression zip | |
| rm -f $parentdir/db.mv.db | |
| # Import data from the backup.zip to the new db file | |
| echo "Importing data..." | |
| java -cp h2-2.1.214.jar org.h2.tools.RunScript -url jdbc:h2:$parentdir/db -script $parentdir/backup.zip -options compression zip variable_binary | |
| rm -f $parentdir/backup.zip | |
| echo "$parentdir/db migrated succesfully" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment