-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathdbschema-generate.sh
executable file
·43 lines (39 loc) · 1.06 KB
/
dbschema-generate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
DEFAULT_OUTPUT="./schema.sql"
DEFAULT_DNPROPS="./dev/scripts/dbschema-generate.datanucleus.properties"
function printHelp() {
echo "Generate the database schema for Dependency-Track."
echo ""
echo "Usage: $0 [-o <OUTPUT_FILE>] [-p <PROPERTIES_FILE>]"
echo "Options:"
echo " -o Set output path for the schema (default: $DEFAULT_OUTPUT)"
echo " -p Set path to DataNucleus properties (default: $DEFAULT_DNPROPS)"
echo ""
echo "This script uses the DataNucleus schema tool:"
echo " https://www.datanucleus.org/products/accessplatform/jdo/persistence.html#schematool"
echo ""
}
while getopts ":h:o:p:" opt; do
case $opt in
o)
output=$OPTARG
;;
p)
dnprops=$OPTARG
;;
h)
printHelp
exit
;;
*)
printHelp
exit
;;
esac
done
mvn datanucleus:schema-create \
-DpersistenceUnitName=Alpine \
-Dprops="${dnprops:-$DEFAULT_DNPROPS}" \
-DcompleteDdl=true \
-DddlFile="${output:-$DEFAULT_OUTPUT}" \
-Dlog4jConfiguration=./dev/scripts/dbschema-generate.log4j.properties