Blame view

src/scripts/delete_all_requests.sh 611 Bytes
eecfb779   haribo   Date: 26/05/2016
1
# This mini-script deletes all your alerts, requests, alerts, albums, plans, shs and schedules in db
fafae58f   haribo   Cleaned directory
2
3
4
5
6
7
8
9
10
11
12
# You need to have a root user with no password on your DB

SCRIPT_PATH=$0
SCRIPT_PATH=${SCRIPT_PATH%/*}

cd $SCRIPT_PATH/..

MYSQL=`grep "MYSQL = " pyros/settings.py`
MYSQL=${MYSQL##* }
MYSQL=${MYSQL%?}

eecfb779   haribo   Date: 26/05/2016
13
14
REQUEST="delete from alert ; delete from plan ; delete from album ; delete from sequence ; delete from alert ; delete from request ; delete from schedule_has_sequences ; delete from schedule"

fafae58f   haribo   Cleaned directory
15
if [ "$MYSQL" == "True" ]; then
eecfb779   haribo   Date: 26/05/2016
16
    mysql -u root -e "$REQUEST" pyros
fafae58f   haribo   Cleaned directory
17
else
eecfb779   haribo   Date: 26/05/2016
18
    sqlite3 db.sqlite3 "$REQUEST"
fafae58f   haribo   Cleaned directory
19
fi