Script to verify the DB consistency.

master
Philippe PITTOLI 2020-04-17 12:04:55 +02:00
parent c159ac6382
commit 7137ddeda8
1 changed files with 26 additions and 0 deletions

26
utils/verify-db-consistency.sh Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/zsh
if [ $# -ne 1 ] || [ $1 = "-h" ]
then
echo "usage: $0 todod-storage"
exit 0
fi
storage=$1
echo "verify the list-tasks relation: list have tasks, these tasks must exists"
for list in ${storage}/data/lists/indices/by_id/*
do
echo "list: $list"
# echo "Tasks:"
cat $list | jq -r ".tasks[]" | while read task
do
ls ${storage}/data/tasks/indices/by_id/$task.json 2>/dev/null 1>/dev/null
if [ $? -eq 0 ]
then
# echo "- task $task"
else
echo "- task: ${storage}/data/tasks/indices/by_id/$task.json doesn't exist"
fi
done
done