-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdbInit.js
More file actions
22 lines (20 loc) · 622 Bytes
/
dbInit.js
File metadata and controls
22 lines (20 loc) · 622 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import userdata from "./database/dbInit/userdata.init.js";
import serverdata from "./database/dbInit/serverdata.init.js";
import minimist from "minimist";
const initDB = async (reset_db) => {
try {
let inits = [userdata(reset_db), serverdata(reset_db)];
await Promise.all(inits);
} catch (e) {
console.log(e);
};
};
(async function main() {
let argv = minimist(process.argv.slice(2));
if (argv.delete) {
if (argv.delete.toLowerCase() == "true") console.log("All data will be deleted");
await initDB(true);
} else {
await initDB(false);
};
})();