Skip to content

Commit b3774be

Browse files
authored
Merge branch 'next' into sdk_sc_changes
2 parents d3db4ec + 6a88c18 commit b3774be

File tree

13 files changed

+64
-32
lines changed

13 files changed

+64
-32
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ Features:
77
Enterprise Features:
88
- [journey_engine] Editing/Deleting/Duplication of blocks and version management
99

10+
## Version 25.03.X
11+
Enterprise fixes:
12+
- [ab-testing] Fixed bug with variant user filtering
13+
- [license] Fixed issue with handling invalid date periods
14+
15+
Fixes:
16+
- [script] Refined delete_custom_events.js to clean up faulty/dead events completely.
17+
1018
## Version 25.03
1119
Features:
1220
- [audit-logs] Exported audit logs from UI now would have "BEFORE" and "AFTER" fields

bin/countly.install_rhel.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ cp "$DIR/config/supervisord.example.conf" "$DIR/config/supervisord.conf"
5050
if [[ "$CENTOS_MAJOR" = "9" ]]; then
5151
sudo rpm -ivh https://pkgs.sysadmins.ws/el8/base/x86_64/ipa-gothic-fonts-003.03-15.el8.noarch.rpm
5252
else
53-
sudo yum install https://pkgs.sysadmins.ws/el8/base/x86_64/raven-release-1.0-3.el8.noarch.rpm
53+
sudo yum install -y https://pkgs.sysadmins.ws/el8/base/x86_64/raven-release-1.0-3.el8.noarch.rpm
5454
sudo yum install -y ipa-gothic-fonts
5555
fi
5656

bin/scripts/expire-data/delete_custom_events.js

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,75 @@
55
* Command: node delete_custom_events.js
66
*/
77

8-
98
const { ObjectId } = require('mongodb');
109
const pluginManager = require('../../../plugins/pluginManager.js');
1110
const common = require('../../../api/utils/common.js');
1211
const drillCommon = require('../../../plugins/drill/api/common.js');
1312

13+
const DRY_RUN = true;
1414
const APP_ID = "";
15-
const EVENTS = []; //If empty, no events will be deleted
15+
const EVENTS = []; // If empty, no events will be deleted . The format has to be "event1","event2"
1616

1717
Promise.all([pluginManager.dbConnection("countly"), pluginManager.dbConnection("countly_drill")]).then(async function([countlyDb, drillDb]) {
1818
console.log("Connected to databases...");
1919

2020
//SET COMMON DB AND DRILL DB
2121
common.db = countlyDb;
2222
common.drillDb = drillDb;
23-
2423
//GET APP
2524
try {
2625
const app = await countlyDb.collection("apps").findOne({_id: ObjectId(APP_ID)}, {_id: 1, name: 1});
2726
console.log("App:", app.name);
2827
//GET EVENTS
29-
var events = EVENTS;
28+
let events = EVENTS;
3029
if (!events.length) {
31-
close("No events to delete");
30+
console.log("Fetching events from drill_meta...");
31+
const metaEvents = await drillDb.collection("drill_meta").aggregate([
32+
{
33+
$match: {
34+
'app_id': app._id + "",
35+
"type": "e",
36+
"e": { $nin: events }
37+
}
38+
},
39+
{
40+
$group: {
41+
_id: "$e"
42+
}
43+
},
44+
{
45+
$project: {
46+
_id: 0,
47+
e: "$_id"
48+
}
49+
}
50+
]).toArray();
51+
events = metaEvents.map(e => e.e);
3252
}
33-
else {
53+
console.log("Events to delete:", events);
54+
if (DRY_RUN) {
55+
console.log("DRY_RUN enabled. No changes will be made.");
56+
return close();
57+
}
58+
if (!events.length) {
59+
return close("No events to delete");
60+
}
61+
try {
3462
//DELETE EVENTS
35-
try {
36-
console.log(1 + ") Deleting drill events:");
37-
await deleteDrillEvents(app._id, events);
38-
console.log(2 + ") Deleting countly events:");
39-
await deleteCountlyEvents(app._id, events);
40-
console.log(3 + ") Deleting event times:");
41-
await deleteEventTimes(app._id, events);
42-
console.log(4 + ") Deleting event groups:");
43-
await deleteEventGroups(app._id, events);
44-
console.log(5 + ") Deleting event keys:");
45-
await deleteEventKeys(app._id, events);
46-
close();
47-
}
48-
catch (err) {
49-
close(err);
50-
}
63+
console.log(1 + ") Deleting drill events:");
64+
await deleteDrillEvents(app._id, events);
65+
console.log(2 + ") Deleting countly events:");
66+
await deleteCountlyEvents(app._id, events);
67+
console.log(3 + ") Deleting event times:");
68+
await deleteEventTimes(app._id, events);
69+
console.log(4 + ") Deleting event groups:");
70+
await deleteEventGroups(app._id, events);
71+
console.log(5 + ") Deleting event keys:");
72+
await deleteEventKeys(app._id, events);
73+
close();
74+
}
75+
catch (err) {
76+
close(err);
5177
}
5278
}
5379
catch (err) {
@@ -115,4 +141,4 @@ Promise.all([pluginManager.dbConnection("countly"), pluginManager.dbConnection("
115141
countlyDb.close();
116142
drillDb.close();
117143
}
118-
});
144+
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

bin/upgrade/24.12/upgrade_db.sh renamed to bin/upgrade/25.03/upgrade_db.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
VER="24.12"
3+
VER="25.03"
44

55
CONTINUE="$(countly check before upgrade db "$VER")"
66

bin/upgrade/24.12/upgrade_fs.sh renamed to bin/upgrade/25.03/upgrade_fs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
echo "Running filesystem modifications"
44

5-
VER="24.12"
5+
VER="25.03"
66

77
CONTINUE="$(countly check before upgrade fs "$VER")"
88

0 commit comments

Comments
 (0)