You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# set the playtakdb folder to the parent directory variable
3
-
$dbPath = "../../playtakdb"
4
+
scriptpath=$(dirname "$(readlink -f "$0")")
5
+
dbpath="$scriptpath/../../playtakdb"
6
+
7
+
# set the database paths
8
+
playersdb="$dbpath/players.db"
9
+
gamesdb="$dbpath/games.db"
4
10
5
-
#check if playtakdb folder exists
11
+
# check if playtakdb folder exists
6
12
if [ !-d$dbpath ];then
7
-
mkdir $dbpath
8
-
fi
9
-
#remove existing
10
-
if [ -f$dbPath/players.db ];then
11
-
rm $dbPath/players.db
13
+
mkdir "$dbpath"
12
14
fi
13
15
14
-
if [ -f$dbPath/games.db ];then
15
-
rm $dbPath/games.db
16
+
# remove existing
17
+
if [ -f$playersdb ];then
18
+
rm "$playersdb"
19
+
fi
20
+
if [ -f$gamesdb ];then
21
+
rm "$gamesdb"
16
22
fi
17
23
18
-
$playersdb = "$dbPath/players.db"
19
-
$gamesdb = "$dbPath/games.db"
20
-
21
-
#create db, tables
24
+
# create db, tables
22
25
echo"CREATE TABLE players (id INT PRIMARY_KEY, name VARCHAR(20), password VARCHAR(50), email VARCHAR(50), rating real default 1000, boost real default 750, ratedgames int default 0, maxrating real default 1000, ratingage real default 0, ratingbase int default 0, unrated int default 0, isbot int default 0, fatigue text default '{}', is_admin int default 0, is_mod int default 0, is_gagged int default 0, is_banned int default 0, participation_rating int default 1000);"| sqlite3 $playersdb
23
26
echo"CREATE TABLE games (id INTEGER PRIMARY KEY, date INT, size INT, player_white VARCHAR(20), player_black VARCHAR(20), notation TEXT, result VARCAR(10), timertime INT DEFAULT 0, timerinc INT DEFAULT 0, rating_white int default 1000, rating_black int default 1000, unrated int default 0, tournament int default 0, komi int default 0, pieces int default -1, capstones int default -1, rating_change_white int default 0, rating_change_black int default 0, extra_time_amount int default 0, extra_time_trigger int default 0);"| sqlite3 $gamesdb
0 commit comments