From 8f3fdb377c3696abfd4be7189fdc0a273df010b2 Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Fri, 22 Jul 2022 19:15:47 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D0=B0=D1=8F=20=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D1=81=D0=B8=D1=8F=20=D0=B1=D1=83=D0=B4=D0=B5=D1=82=20?= =?UTF-8?q?=D0=BA=D0=B0=D0=BA=204.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 4 +-- package.json | 5 ++-- scripts/migrate-db-from-v4.6-to-v4.7.js | 38 ------------------------- 3 files changed, 4 insertions(+), 43 deletions(-) delete mode 100644 scripts/migrate-db-from-v4.6-to-v4.7.js diff --git a/package-lock.json b/package-lock.json index 18f20666..1b868c9b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "jaba", - "version": "3.4.7", + "version": "4.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "jaba", - "version": "3.4.7", + "version": "4.0", "license": "ISC", "dependencies": { "@discordjs/opus": "^0.7.0", diff --git a/package.json b/package.json index c9c033dd..485716a4 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,13 @@ { "name": "jaba", - "version": "3.4.7", + "version": "4.0", "description": "A very complete Discord bot (more than 100 commands) that uses the Discord.js", "main": "index.js", "private": true, "scripts": { "start": "node .", "lint": "eslint . --ext .js", - "testcfg": "node scripts/verify-config.js", - "migratedb": "node scripts/migrate-db-from-v4.6-to-v4.7.js" + "testcfg": "node scripts/verify-config.js" }, "author": "Jonny_Bro", "license": "ISC", diff --git a/scripts/migrate-db-from-v4.6-to-v4.7.js b/scripts/migrate-db-from-v4.6-to-v4.7.js deleted file mode 100644 index dcec93fa..00000000 --- a/scripts/migrate-db-from-v4.6-to-v4.7.js +++ /dev/null @@ -1,38 +0,0 @@ -const chalk = require("chalk"); -console.log(chalk.blue("Migrating database from v4.6.4 to v4.7.0...\n\n")); - -let MongoClient; - -try { - MongoClient = require("mongodb").MongoClient; -} catch (e) { - console.log(chalk.red("Cannot find module mongodb. Please install it using \"npm install mongodb\" before executing script.")); - process.exit(1); -} - -const config = require("../config"); -const dbName = config.mongoDB.split("/").pop(); -const baseURL = config.mongoDB.substr(0, config.mongoDB.length - dbName.length); -const client = new MongoClient(baseURL, { - useUnifiedTopology: true -}); - -client.connect().then(async () => { - console.log(chalk.green("Connected successfully to mongoDB database.")); - - const db = client.db(dbName); - const guilds = db.collection("guilds"); - - const count = await guilds.countDocuments({ $or: [{ language: "english" }, { language: "russian" }] }); - console.log(chalk.yellow(`${count} guilds need to be migrated. Migrating...`)); - - await guilds.updateMany({ language: "english" }, { $set: { language: "en-US" } }); - await guilds.updateMany({ language: "russian" }, { $set: { language: "ru-RU" } }); - - console.log(chalk.green(`${count} guilds migrated.`)); - console.log(chalk.blue("\n\nDatabase migrated from v4.6.4 to v4.7.0...")); - process.exit(0); -}).catch(() => { - console.log(chalk.red("Couldn't connect to mongoDB database...")); - process.exit(1); -}); \ No newline at end of file