-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupgrades.js
32 lines (26 loc) · 918 Bytes
/
upgrades.js
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
export function upgradeScripts() {
// This function will run during the upgrade process to ensure everything is cleared
const upgrades = [
function (context) {
context.log("info", "Running upgrade script to clear all stored data.");
// Clear all stored variables
context.setVariableValues({});
// Clear all stored configuration settings
context.setConfig({});
// Clear all stored states
if (context.getStates) {
const states = context.getStates();
for (const key in states) {
if (Object.hasOwnProperty.call(states, key)) {
context.setState(key, undefined);
}
}
}
// Clear any other module-specific storage if necessary
// For example, clear feedbacks, subscriptions, etc.
context.log("info", "All stored data has been cleared.");
return true;
},
];
return upgrades;
}