summaryrefslogtreecommitdiffstats
path: root/main/acf-weblog/acf-weblog.post-upgrade
blob: a15590cc7334b85aa554d144b3d765fa9b90afa3 (plain)
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
#!/bin/sh

new=$1
old=$2

# if current is not older than 0.5.4 we exit.
if ! [ "$(apk version -t $old 0.5.4)" = "<" ]; then
	exit 0
fi

psql -U postgres -c "ALTER TABLE weblog ALTER bytes TYPE bigint"\
	webproxylog
psql -U postgres -c "ALTER TABLE pubweblog ALTER bytes TYPE bigint"\
	webproxylog
psql -U postgres -c "ALTER TABLE blocklog ALTER bytes TYPE bigint"\
	webproxylog
psql -U postgres -c "ALTER TABLE pubblocklog ALTER bytes TYPE bigint"\
	webproxylog

# if current is not older than 0.4.5 we exit.
if ! [ "$(apk version -t $old 0.4.5)" = "<" ]; then
	exit 0
fi

psql -U postgres -c "ALTER TABLE dbhistlog ALTER logdatetime TYPE timestamp(3)"\
	webproxylog

if ! [ "$(apk version -t $old 0.4.0)" = "<" ]; then
	exit 0
fi

psql -U postgres -c "ALTER TABLE weblog ADD COLUMN shortreason text" \
	webproxylog
psql -U postgres -c "ALTER TABLE pubweblog ADD COLUMN shortreason text" \
	webproxylog
psql -U postgres -c "ALTER TABLE pubblocklog ADD COLUMN shortreason text" \
	webproxylog  
psql -U postgres -c "ALTER TABLE blocklog ADD COLUMN shortreason text" \
	webproxylog

exit 0