Skip to content
Snippets Groups Projects
Commit 815d5ec0 authored by Ted Trask's avatar Ted Trask
Browse files

main/acf-weblog: upgrade to 0.6.0

parent b2557f15
No related merge requests found
# Contributor: Ted Trask <ttrask01@yahoo.com>
# Maintainer: Ted Trask <ttrask01@yahoo.com>
pkgname=acf-weblog
pkgver=0.5.9
pkgrel=2
pkgver=0.6.0
pkgrel=0
pkgdesc="ACF for web proxy (squid and dansguardian) logfiles"
url="http://git.alpinelinux.org/cgit/acf-weblog"
arch="noarch"
......
......@@ -3,40 +3,63 @@
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
# if current is older than 0.4.0 we update.
if [ "$(apk version -t $old 0.4.0)" = "<" ]; then
psql -U postgres -c "ALTER TABLE weblog ALTER bytes TYPE bigint"\
webproxylog
psql -U postgres -c "ALTER TABLE pubweblog ALTER bytes TYPE bigint"\
psql -U postgres -c "ALTER TABLE weblog ADD COLUMN shortreason text" \
webproxylog
psql -U postgres -c "ALTER TABLE blocklog ALTER bytes TYPE bigint"\
psql -U postgres -c "ALTER TABLE pubweblog ADD COLUMN shortreason text" \
webproxylog
psql -U postgres -c "ALTER TABLE pubblocklog ALTER bytes TYPE bigint"\
psql -U postgres -c "ALTER TABLE pubblocklog ADD COLUMN shortreason text" \
webproxylog
psql -U postgres -c "ALTER TABLE blocklog ADD COLUMN shortreason text" \
webproxylog
# if current is not older than 0.4.5 we exit.
if ! [ "$(apk version -t $old 0.4.5)" = "<" ]; then
exit 0
fi
# if current is older than 0.4.5 we update.
if [ "$(apk version -t $old 0.4.5)" = "<" ]; then
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" \
# if current is older than 0.5.4 we update.
if [ "$(apk version -t $old 0.5.4)" = "<" ]; then
psql -U postgres -c "ALTER TABLE weblog ALTER bytes TYPE bigint"\
webproxylog
psql -U postgres -c "ALTER TABLE pubweblog ADD COLUMN shortreason text" \
psql -U postgres -c "ALTER TABLE pubweblog ALTER bytes TYPE bigint"\
webproxylog
psql -U postgres -c "ALTER TABLE pubblocklog ADD COLUMN shortreason text" \
webproxylog
psql -U postgres -c "ALTER TABLE blocklog ADD COLUMN shortreason text" \
psql -U postgres -c "ALTER TABLE blocklog ALTER bytes TYPE bigint"\
webproxylog
psql -U postgres -c "ALTER TABLE pubblocklog ALTER bytes TYPE bigint"\
webproxylog
exit 0
fi
# if current is older than 0.6.0 we update.
if [ "$(apk version -t $old 0.6.0)" = "<" ]; then
mkdir /etc/weblog
mv /etc/weblog.conf /etc/weblog/
echo "Executing db updates"
psql -U postgres -c "ALTER TABLE pubweblog ADD COLUMN badyesno int, ADD COLUMN deniedyesno int, ADD COLUMN bypassyesno int, ADD COLUMN wordloc text, ADD COLUMN goodwordloc text, ADD COLUMN selected boolean, ADD COLUMN id int UNIQUE" -d webproxylog
psql -U weblogowner -c "CREATE SEQUENCE pubweblog_id_seq" -d webproxylog
psql -U postgres -c "ALTER TABLE pubweblog ALTER COLUMN id SET DEFAULT NEXTVAL('pubweblog_id_seq')" -d webproxylog
psql -U postgres -c "UPDATE pubweblog SET id = NEXTVAL('pubweblog_id_seq')" -d webproxylog
psql -U postgres -c "INSERT INTO pubweblog SELECT *,'0','1','0','','','false' FROM pubblocklog" -d webproxylog
psql -U postgres -c "INSERT INTO pubweblog SELECT *,'0','0','0','','','false' FROM weblog" -d webproxylog
psql -U postgres -c "INSERT INTO pubweblog SELECT *,'0','1','0','','','false' FROM blocklog" -d webproxylog
psql -U postgres -c "ALTER TABLE weblog ADD COLUMN badyesno int, ADD COLUMN deniedyesno int, ADD COLUMN bypassyesno int, ADD COLUMN wordloc text, ADD COLUMN goodwordloc text" -d webproxylog
psql -U weblogowner -c "CREATE TABLE pubweblog_history(sourcename character varying(40), clientip inet NOT NULL, clientuserid character varying(64) NOT NULL, logdatetime timestamp(3) without time zone NOT NULL, uri text NOT NULL, bytes bigint NOT NULL, reason text, score integer, shortreason text, badyesno int, deniedyesno int, bypassyesno int, wordloc text, goodwordloc text, selected boolean, id int)" -d webproxylog
psql -U postgres -c "GRANT SELECT ON pubweblog_history TO webloguser" -d webproxylog
psql -U postgres -c "DROP TABLE pubblocklog" -d webproxylog
psql -U postgres -c "DROP TABLE watchlist" -d webproxylog
psql -U postgres -c "DROP TABLE blocklog" -d webproxylog
fi
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment