mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-27 01:30:18 +00:00
Add id (primary key, autoincrement) field to lists tables
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
b372f808dd
commit
983117d788
2 changed files with 29 additions and 5 deletions
|
@ -118,12 +118,16 @@ database_table_from_file() {
|
|||
inputfile="${source}"
|
||||
else
|
||||
# Apply format for white-, blacklist, regex, and adlists tables
|
||||
local rowid
|
||||
declare -i rowid
|
||||
rowid=1
|
||||
# Read file line by line
|
||||
grep -v '^ *#' < "${source}" | while IFS= read -r domain
|
||||
do
|
||||
# Only add non-empty lines
|
||||
if [[ ! -z "${domain}" ]]; then
|
||||
echo "\"${domain}\",1,${timestamp},${timestamp}" >> "${tmpFile}"
|
||||
echo "${rowid},\"${domain}\",1,${timestamp},${timestamp}" >> "${tmpFile}"
|
||||
rowid+=1
|
||||
fi
|
||||
done
|
||||
inputfile="${tmpFile}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue