@@ -19,13 +19,13 @@ upgrade_gravityDB(){
19
19
auditFile=" ${piholeDir} /auditlog.list"
20
20
21
21
# Get database version
22
- version=" $( sqlite3 " ${database} " " SELECT \" value\" FROM \" info\" WHERE \" property\" = 'version';" ) "
22
+ version=" $( pihole-FTL sqlite3 " ${database} " " SELECT \" value\" FROM \" info\" WHERE \" property\" = 'version';" ) "
23
23
24
24
if [[ " $version " == " 1" ]]; then
25
25
# This migration script upgrades the gravity.db file by
26
26
# adding the domain_audit table
27
27
echo -e " ${INFO} Upgrading gravity database from version 1 to 2"
28
- sqlite3 " ${database} " < " ${scriptPath} /1_to_2.sql"
28
+ pihole-FTL sqlite3 " ${database} " < " ${scriptPath} /1_to_2.sql"
29
29
version=2
30
30
31
31
# Store audit domains in database table
@@ -40,58 +40,58 @@ upgrade_gravityDB(){
40
40
# renaming the regex table to regex_blacklist, and
41
41
# creating a new regex_whitelist table + corresponding linking table and views
42
42
echo -e " ${INFO} Upgrading gravity database from version 2 to 3"
43
- sqlite3 " ${database} " < " ${scriptPath} /2_to_3.sql"
43
+ pihole-FTL sqlite3 " ${database} " < " ${scriptPath} /2_to_3.sql"
44
44
version=3
45
45
fi
46
46
if [[ " $version " == " 3" ]]; then
47
47
# This migration script unifies the formally separated domain
48
48
# lists into a single table with a UNIQUE domain constraint
49
49
echo -e " ${INFO} Upgrading gravity database from version 3 to 4"
50
- sqlite3 " ${database} " < " ${scriptPath} /3_to_4.sql"
50
+ pihole-FTL sqlite3 " ${database} " < " ${scriptPath} /3_to_4.sql"
51
51
version=4
52
52
fi
53
53
if [[ " $version " == " 4" ]]; then
54
54
# This migration script upgrades the gravity and list views
55
55
# implementing necessary changes for per-client blocking
56
56
echo -e " ${INFO} Upgrading gravity database from version 4 to 5"
57
- sqlite3 " ${database} " < " ${scriptPath} /4_to_5.sql"
57
+ pihole-FTL sqlite3 " ${database} " < " ${scriptPath} /4_to_5.sql"
58
58
version=5
59
59
fi
60
60
if [[ " $version " == " 5" ]]; then
61
61
# This migration script upgrades the adlist view
62
62
# to return an ID used in gravity.sh
63
63
echo -e " ${INFO} Upgrading gravity database from version 5 to 6"
64
- sqlite3 " ${database} " < " ${scriptPath} /5_to_6.sql"
64
+ pihole-FTL sqlite3 " ${database} " < " ${scriptPath} /5_to_6.sql"
65
65
version=6
66
66
fi
67
67
if [[ " $version " == " 6" ]]; then
68
68
# This migration script adds a special group with ID 0
69
69
# which is automatically associated to all clients not
70
70
# having their own group assignments
71
71
echo -e " ${INFO} Upgrading gravity database from version 6 to 7"
72
- sqlite3 " ${database} " < " ${scriptPath} /6_to_7.sql"
72
+ pihole-FTL sqlite3 " ${database} " < " ${scriptPath} /6_to_7.sql"
73
73
version=7
74
74
fi
75
75
if [[ " $version " == " 7" ]]; then
76
76
# This migration script recreated the group table
77
77
# to ensure uniqueness on the group name
78
78
# We also add date_added and date_modified columns
79
79
echo -e " ${INFO} Upgrading gravity database from version 7 to 8"
80
- sqlite3 " ${database} " < " ${scriptPath} /7_to_8.sql"
80
+ pihole-FTL sqlite3 " ${database} " < " ${scriptPath} /7_to_8.sql"
81
81
version=8
82
82
fi
83
83
if [[ " $version " == " 8" ]]; then
84
84
# This migration fixes some issues that were introduced
85
85
# in the previous migration script.
86
86
echo -e " ${INFO} Upgrading gravity database from version 8 to 9"
87
- sqlite3 " ${database} " < " ${scriptPath} /8_to_9.sql"
87
+ pihole-FTL sqlite3 " ${database} " < " ${scriptPath} /8_to_9.sql"
88
88
version=9
89
89
fi
90
90
if [[ " $version " == " 9" ]]; then
91
91
# This migration drops unused tables and creates triggers to remove
92
92
# obsolete groups assignments when the linked items are deleted
93
93
echo -e " ${INFO} Upgrading gravity database from version 9 to 10"
94
- sqlite3 " ${database} " < " ${scriptPath} /9_to_10.sql"
94
+ pihole-FTL sqlite3 " ${database} " < " ${scriptPath} /9_to_10.sql"
95
95
version=10
96
96
fi
97
97
if [[ " $version " == " 10" ]]; then
@@ -101,31 +101,31 @@ upgrade_gravityDB(){
101
101
# to keep the copying process generic (needs the same columns in both the
102
102
# source and the destination databases).
103
103
echo -e " ${INFO} Upgrading gravity database from version 10 to 11"
104
- sqlite3 " ${database} " < " ${scriptPath} /10_to_11.sql"
104
+ pihole-FTL sqlite3 " ${database} " < " ${scriptPath} /10_to_11.sql"
105
105
version=11
106
106
fi
107
107
if [[ " $version " == " 11" ]]; then
108
108
# Rename group 0 from "Unassociated" to "Default"
109
109
echo -e " ${INFO} Upgrading gravity database from version 11 to 12"
110
- sqlite3 " ${database} " < " ${scriptPath} /11_to_12.sql"
110
+ pihole-FTL sqlite3 " ${database} " < " ${scriptPath} /11_to_12.sql"
111
111
version=12
112
112
fi
113
113
if [[ " $version " == " 12" ]]; then
114
114
# Add column date_updated to adlist table
115
115
echo -e " ${INFO} Upgrading gravity database from version 12 to 13"
116
- sqlite3 " ${database} " < " ${scriptPath} /12_to_13.sql"
116
+ pihole-FTL sqlite3 " ${database} " < " ${scriptPath} /12_to_13.sql"
117
117
version=13
118
118
fi
119
119
if [[ " $version " == " 13" ]]; then
120
120
# Add columns number and status to adlist table
121
121
echo -e " ${INFO} Upgrading gravity database from version 13 to 14"
122
- sqlite3 " ${database} " < " ${scriptPath} /13_to_14.sql"
122
+ pihole-FTL sqlite3 " ${database} " < " ${scriptPath} /13_to_14.sql"
123
123
version=14
124
124
fi
125
125
if [[ " $version " == " 14" ]]; then
126
126
# Changes the vw_adlist created in 5_to_6
127
127
echo -e " ${INFO} Upgrading gravity database from version 14 to 15"
128
- sqlite3 " ${database} " < " ${scriptPath} /14_to_15.sql"
128
+ pihole-FTL sqlite3 " ${database} " < " ${scriptPath} /14_to_15.sql"
129
129
version=15
130
130
fi
131
131
}
0 commit comments