mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-26 16:15:19 +00:00
New db migration script - multiplatform, fix mariadb migrations
This commit is contained in:
+5
-18
@@ -2,10 +2,10 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const { stdout, exit } = require("process");
|
||||
const readline = require("readline");
|
||||
const { execIn } = require("./utils.js");
|
||||
const { ask } = require("./utils/ask.js");
|
||||
|
||||
|
||||
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
||||
const data = { env: [], config: { register: {} }, extra_pkgs: [] };
|
||||
let rights = [];
|
||||
|
||||
@@ -128,7 +128,7 @@ async function main() {
|
||||
printTitle("Step 5: extra options");
|
||||
|
||||
if (/y?/i.test(await ask("Use fast BCrypt implementation (requires a compiler) (Y/n): "))) data.extra_pkgs.push("bcrypt");
|
||||
if (/y?/.test(await ask("Enable support for widgets (requires compiler, known to fail on some ARM devices.) (Y/n): ")))
|
||||
if (/y?/i.test(await ask("Enable support for widgets (requires compiler, known to fail on some ARM devices.) (Y/n): ")))
|
||||
data.extra_pkgs.push("canvas");
|
||||
|
||||
printTitle("Step 6: finalizing...");
|
||||
@@ -201,12 +201,7 @@ async function askRights() {
|
||||
return selectedRights;
|
||||
}
|
||||
|
||||
async function askRight(right) {
|
||||
let answer = await ask(`${right}: `);
|
||||
if (answer == "y") return true;
|
||||
else if (answer == "n") return false;
|
||||
else return askRight(right);
|
||||
}
|
||||
|
||||
|
||||
function printTitle(input) {
|
||||
let width = stdout.columns / 2 - 1; //40
|
||||
@@ -214,15 +209,7 @@ function printTitle(input) {
|
||||
console.log("-".repeat(width - input.length / 2), input, "-".repeat(width - input.length / 2));
|
||||
console.log();
|
||||
}
|
||||
async function ask(question) {
|
||||
return new Promise((resolve, _reject) => {
|
||||
return rl.question(question, (answer) => {
|
||||
resolve(answer);
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function BitFlag(int) {
|
||||
return 1n << BigInt(int);
|
||||
|
||||
Reference in New Issue
Block a user