mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 21:44:55 +03:00
fix: ensure database directory exists before running knex
This commit is contained in:
parent
02ca506079
commit
123812ad81
@ -3,11 +3,8 @@ import path from "node:path";
|
|||||||
|
|
||||||
export const defaultDownloadsPath = app.getPath("downloads");
|
export const defaultDownloadsPath = app.getPath("downloads");
|
||||||
|
|
||||||
export const databasePath = path.join(
|
export const databaseDirectory = path.join(app.getPath("appData"), "hydra");
|
||||||
app.getPath("appData"),
|
export const databasePath = path.join(databaseDirectory, "hydra.db");
|
||||||
"hydra",
|
|
||||||
"hydra.db"
|
|
||||||
);
|
|
||||||
|
|
||||||
export const logsPath = path.join(app.getPath("appData"), "hydra", "logs");
|
export const logsPath = path.join(app.getPath("appData"), "hydra", "logs");
|
||||||
|
|
||||||
|
@ -4,12 +4,14 @@ import updater from "electron-updater";
|
|||||||
import i18n from "i18next";
|
import i18n from "i18next";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import url from "node:url";
|
import url from "node:url";
|
||||||
|
import fs from "node:fs";
|
||||||
import { electronApp, optimizer } from "@electron-toolkit/utils";
|
import { electronApp, optimizer } from "@electron-toolkit/utils";
|
||||||
import { logger, PythonInstance, WindowManager } from "@main/services";
|
import { logger, PythonInstance, WindowManager } from "@main/services";
|
||||||
import { dataSource } from "@main/data-source";
|
import { dataSource } from "@main/data-source";
|
||||||
import resources from "@locales";
|
import resources from "@locales";
|
||||||
import { userPreferencesRepository } from "@main/repository";
|
import { userPreferencesRepository } from "@main/repository";
|
||||||
import { knexClient, migrationConfig } from "./knex-client";
|
import { knexClient, migrationConfig } from "./knex-client";
|
||||||
|
import { databaseDirectory } from "./constants";
|
||||||
|
|
||||||
const { autoUpdater } = updater;
|
const { autoUpdater } = updater;
|
||||||
|
|
||||||
@ -54,6 +56,10 @@ if (process.defaultApp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const runMigrations = async () => {
|
const runMigrations = async () => {
|
||||||
|
if (!fs.existsSync(databaseDirectory)) {
|
||||||
|
fs.mkdirSync(databaseDirectory, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
await knexClient.migrate.list(migrationConfig).then((result) => {
|
await knexClient.migrate.list(migrationConfig).then((result) => {
|
||||||
logger.log(
|
logger.log(
|
||||||
"Migrations to run:",
|
"Migrations to run:",
|
||||||
|
@ -2879,10 +2879,10 @@ axe-core@=4.7.0:
|
|||||||
resolved "https://registry.npmjs.org/axe-core/-/axe-core-4.7.0.tgz"
|
resolved "https://registry.npmjs.org/axe-core/-/axe-core-4.7.0.tgz"
|
||||||
integrity sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ==
|
integrity sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ==
|
||||||
|
|
||||||
axios@^1.6.8:
|
axios@^1.7.7:
|
||||||
version "1.6.8"
|
version "1.7.7"
|
||||||
resolved "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz"
|
resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.7.tgz#2f554296f9892a72ac8d8e4c5b79c14a91d0a47f"
|
||||||
integrity sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==
|
integrity sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==
|
||||||
dependencies:
|
dependencies:
|
||||||
follow-redirects "^1.15.6"
|
follow-redirects "^1.15.6"
|
||||||
form-data "^4.0.0"
|
form-data "^4.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user