-
Notifications
You must be signed in to change notification settings - Fork 0
/
schemaspyw
executable file
·47 lines (36 loc) · 1.11 KB
/
schemaspyw
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
44
45
46
47
#!/bin/bash
set -o errexit
schemaspy_version="6.0.0"
ensure_jarfile()
{
local jarfile="schemaspy-${schemaspy_version}.jar"
[[ -f $jarfile ]] ||
wget "https://github.com/schemaspy/schemaspy/releases/download/v${schemaspy_version}/$jarfile"
printf '%s' "$jarfile"
}
ensure_driver_path()
{
local driver_version="42.2.5"
local driver_path="$HOME/.m2/repository/org/postgresql/postgresql/$driver_version/postgresql-${driver_version}.jar"
[[ -f $driver_path ]] || driver_path="postgresql-${driver_version}.jar"
[[ -f $driver_path ]] ||
wget -O "$driver_path" "https://search.maven.org/remotecontent?filepath=org/postgresql/postgresql/$driver_version/$driver_path"
printf '%s' "$driver_path"
}
main()
{
[[ ! -f .env ]] || . .env
local jarfile driver_path
jarfile="$(ensure_jarfile)"
driver_path="$(ensure_driver_path)"
exec java -jar "$jarfile" \
-t pgsql11 \
-dp "$driver_path" \
-host localhost \
-port "${DB_PORT:-5432}" \
-db prstatbucket \
-u prstatbucket \
-p prstatbucket \
-o schemaspy
}
main