-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDeleteFromDB.js
61 lines (53 loc) · 1.52 KB
/
DeleteFromDB.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function DeleteTags(connection) {
connection.query('DELETE FROM `hashtags`WHERE `times` < 10000', function (err, rows) {
if (err) {
return err;
} else {
console.log("removed unused hashtags");
}
});
}
function DeleteLocTweets(connection) {
connection.query('DELETE FROM `locations`WHERE `tweets` < 10000', function (err, rows) {
if (err) {
return err;
} else {
console.log("removed locations");
}
});
}
function DeleteComments(connection) {
connection.query('DELETE FROM `comments` WHERE `comment` IS NOT NULL', function (err, rows) {
if (err) {
return err;
} else {
console.log("removed comments");
}
});
}
//14400000
function DeleteAmtLocations(connection, num){
connection.query('DELETE FROM `locations`WHERE `tweets`< ' + num, function (err, rows) {
if (err) {
return console.log(err);
} else {
console.log("removed locations");
}
});
}
function DeleteAmtTags(connection, num) {
connection.query('DELETE FROM `hashtags`WHERE `times` < ' + num, function (err, rows) {
if (err) {
return console.log(err);
} else {
console.log("removed Tags");
}
});
}
module.exports = {
'DeleteTags': DeleteTags,
'DeleteLocTweets': DeleteLocTweets,
'DeleteComments': DeleteComments,
'DeleteAmtLocations' : DeleteAmtLocations,
'DeleteAmtTags' : DeleteAmtTags
}