summaryrefslogtreecommitdiff
path: root/devfiles/scripts/bootstrap-strings.sh
blob: 4e5eaf959834823edd0e4bed7da04e2f596cda70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh

##
## This script clears the strings ColumnFamily and then rebuilds it.
## If given a file name, it will put the commands into the file and not run it.
##

export TOOLS=`awk -F= '/jesterpm\.buildtools\.root/ { print $2 }' $HOME/.jesterpm-build-tools.properties`
export DEVFILES=$(dirname $0)/..

SAVEFILE="$1"
TEMPFILE="$SAVEFILE"
if [ -z "$SAVEFILE" ]; then
    TEMPFILE=`mktemp`
fi

cat > $TEMPFILE << EOF
use GROW;

drop column family strings;

create column family strings
    with key_validation_class = 'UTF8Type'
    and comparator = 'UTF8Type'
    and default_validation_class = 'UTF8Type';
EOF

# Fill with questions
$DEVFILES/scripts/compile-questions.sh >> $TEMPFILE


# Fill with videos
$DEVFILES/scripts/compile-videos.sh >> $TEMPFILE

# GO!
if [ -z "$SAVEFILE" ]; then
    cassandra-cli < $TEMPFILE
    rm $TEMPFILE
fi