aboutsummaryrefslogtreecommitdiffstats
path: root/main/acf-weblog/acf-weblog.post-upgrade
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2011-09-12 17:46:10 +0000
committerTed Trask <ttrask01@yahoo.com>2011-09-12 17:46:10 +0000
commit815d5ec0002dd330d41799483460622218f3b813 (patch)
tree356e7f1ac56aacf46e8e9aee1c62349fc06fa5b0 /main/acf-weblog/acf-weblog.post-upgrade
parentb2557f155f4c76799d4d07764f4c2fb6978b01cb (diff)
downloadaports-815d5ec0002dd330d41799483460622218f3b813.tar.bz2
aports-815d5ec0002dd330d41799483460622218f3b813.tar.xz
main/acf-weblog: upgrade to 0.6.0
Diffstat (limited to 'main/acf-weblog/acf-weblog.post-upgrade')
-rwxr-xr-x[-rw-r--r--]main/acf-weblog/acf-weblog.post-upgrade63
1 files changed, 43 insertions, 20 deletions
diff --git a/main/acf-weblog/acf-weblog.post-upgrade b/main/acf-weblog/acf-weblog.post-upgrade
index a15590cc7..18ed542fc 100644..100755
--- a/main/acf-weblog/acf-weblog.post-upgrade
+++ b/main/acf-weblog/acf-weblog.post-upgrade
@@ -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