Skip to content

Commit 3a6fc70

Browse files
authored
Merge pull request #4330 from Countly/ar2rsawseen/next
Ar2rsawseen/next
2 parents 36e5f90 + f6d2fd6 commit 3a6fc70

File tree

4 files changed

+116
-1
lines changed

4 files changed

+116
-1
lines changed

api/lib/countly.common.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ function getPeriodObject(prmPeriod) {
688688
let zeroIDs = new Set(),
689689
monthIDs = new Set();
690690

691-
for (let index in periodObject.currentPeriodArr) {
691+
for (let index = 0; index < periodObject.currentPeriodArr.length; index++) {
692692
let [year, month] = periodObject.currentPeriodArr[index].split("."),
693693
[pYear, pMonth] = periodObject.previousPeriodArr[index].split(".");
694694

bin/upgrade/DEV/upgrade.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3+
DATE=$(date +%Y-%m-%d:%H:%M:%S)
4+
VERSION="$(basename "${DIR}")"
5+
6+
countly stop
7+
if [ -f "$DIR/upgrade_fs.sh" ]; then
8+
bash "$DIR/upgrade_fs.sh" combined 2>&1 | tee -a "$DIR/../../../log/countly-upgrade-fs-$VERSION-$DATE.log"
9+
fi
10+
if [ -f "$DIR/upgrade_db.sh" ]; then
11+
bash "$DIR/upgrade_db.sh" combined 2>&1 | tee -a "$DIR/../../../log/countly-upgrade-db-$VERSION-$DATE.log"
12+
fi
13+
countly upgrade

bin/upgrade/DEV/upgrade_db.sh

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
VER="23.06"
4+
5+
CONTINUE="$(countly check before upgrade db "$VER")"
6+
7+
if [ "$CONTINUE" != "1" ] && [ "$1" != "combined" ]
8+
then
9+
echo "Database is already up to date with $VER"
10+
read -r -p "Are you sure you want to run this script? [y/N] " response
11+
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
12+
then
13+
CONTINUE=1
14+
fi
15+
fi
16+
17+
if [ "$CONTINUE" == "1" ]
18+
then
19+
echo "Running database modifications"
20+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
21+
SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
22+
23+
if [ "$1" != "combined" ]; then
24+
#upgrade plugins
25+
#countly plugin enable license;
26+
nodejs "$DIR/scripts/install_plugins.js"
27+
fi
28+
29+
#add indexes
30+
nodejs "$DIR/scripts/add_indexes.js"
31+
32+
#run upgrade scripts
33+
countly config "drill.big_list_limit" 1000
34+
nodejs "$SCRIPTS/scripts/script.js"
35+
36+
37+
if [ "$1" != "combined" ]; then
38+
countly upgrade;
39+
fi
40+
41+
#call after check
42+
countly check after upgrade db "$VER"
43+
elif [ "$CONTINUE" == "0" ]
44+
then
45+
echo "Database is already upgraded to $VER"
46+
elif [ "$CONTINUE" == "-1" ]
47+
then
48+
echo "Database is upgraded to higher version"
49+
else
50+
echo "Unknown ugprade state: $CONTINUE"
51+
fi

bin/upgrade/DEV/upgrade_fs.sh

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
echo "Running filesystem modifications"
4+
5+
VER="23.06"
6+
7+
CONTINUE="$(countly check before upgrade fs "$VER")"
8+
9+
if [ "$CONTINUE" != "1" ] && [ "$1" != "combined" ]
10+
then
11+
echo "Filesystem is already up to date with $VER"
12+
read -r -p "Are you sure you want to run this script? [y/N] " response
13+
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
14+
then
15+
CONTINUE=1
16+
fi
17+
fi
18+
19+
if [ "$CONTINUE" == "1" ]
20+
then
21+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
22+
23+
#enable command line
24+
bash "$DIR/scripts/detect.init.sh"
25+
26+
#countly plugin enable sdk;
27+
28+
#upgrade plugins
29+
nodejs "$DIR/scripts/install_plugins.js"
30+
31+
#get web sdk
32+
countly update sdk-web
33+
34+
35+
if [ "$1" != "combined" ]; then
36+
countly upgrade;
37+
else
38+
countly task dist-all;
39+
fi
40+
41+
#call after check
42+
countly check after upgrade fs "$VER"
43+
elif [ "$CONTINUE" == "0" ]
44+
then
45+
echo "Filesystem is already upgraded to $VER"
46+
elif [ "$CONTINUE" == "-1" ]
47+
then
48+
echo "Filesystem is upgraded to higher version"
49+
else
50+
echo "Unknown ugprade state: $CONTINUE"
51+
fi

0 commit comments

Comments
 (0)