nixpkgs/pkgs/by-name/ho/hoarder/patches/fix-migrations-path.patch
2025-02-02 21:37:10 +01:00

16 lines
574 B
Diff

Without this change the migrations script will fail if the working directory
isn't the same directory this file is located in. To improve usability we
specify the migrations folder relative to __dirname, which doesn't depend on the
working directory.
---
--- a/packages/db/migrate.ts
+++ b/packages/db/migrate.ts
@@ -1,4 +1,5 @@
import { db } from "./drizzle";
import { migrate } from "drizzle-orm/better-sqlite3/migrator";
+import path from "path";
-migrate(db, { migrationsFolder: "./drizzle" });
+migrate(db, { migrationsFolder: path.join(__dirname, "./drizzle") });