Skip to content

Commit

Permalink
fix: message and migration
Browse files Browse the repository at this point in the history
  • Loading branch information
zamitto committed Sep 15, 2024
1 parent ff91284 commit f9906bf
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
8 changes: 7 additions & 1 deletion src/main/knex-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ import { databasePath } from "./constants";
import { Hydra2_0_3 } from "./migrations/20240830143811_Hydra_2_0_3";
import { RepackUris } from "./migrations/20240830143906_RepackUris";
import { UpdateUserLanguage } from "./migrations/20240913213944_update_user_language";
import { EnsureRepackUris } from "./migrations/20240915035339_ensure_repack_uris";

export type HydraMigration = Knex.Migration & { name: string };

class MigrationSource implements Knex.MigrationSource<HydraMigration> {
getMigrations(): Promise<HydraMigration[]> {
return Promise.resolve([Hydra2_0_3, RepackUris, UpdateUserLanguage]);
return Promise.resolve([
Hydra2_0_3,
RepackUris,
UpdateUserLanguage,
EnsureRepackUris,
]);
}
getMigrationName(migration: HydraMigration): string {
return migration.name;
Expand Down
17 changes: 17 additions & 0 deletions src/main/migrations/20240915035339_ensure_repack_uris.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { HydraMigration } from "@main/knex-client";
import type { Knex } from "knex";

export const EnsureRepackUris: HydraMigration = {
name: "EnsureRepackUris",
up: async (knex: Knex) => {
await knex.schema.hasColumn("repack", "uris").then(async (exists) => {
if (!exists) {
await knex.schema.table("repack", (table) => {
table.text("uris").notNullable().defaultTo("[]");
});
}
});
},

down: async (_knex: Knex) => {},
};
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,15 @@ export function DownloadSettingsModal({
))}
</div>

{selectedDownloader && selectedDownloader !== Downloader.Torrent && (
<p style={{ marginTop: `${SPACING_UNIT}px` }}>
<span style={{ color: vars.color.warning }}>{t("warning")}</span>{" "}
{t("hydra_needs_to_remain_open")}
</p>
)}
{selectedDownloader != null &&
selectedDownloader !== Downloader.Torrent && (
<p style={{ marginTop: `${SPACING_UNIT}px` }}>
<span style={{ color: vars.color.warning }}>
{t("warning")}
</span>{" "}
{t("hydra_needs_to_remain_open")}
</p>
)}
</div>

<div
Expand Down

0 comments on commit f9906bf

Please sign in to comment.