···6677[[ -d "$DATA_DIR" ]] # Ensure DATA_DIR is defined and exists
8899+# Drizzle will look for configuration in the working directory
1010+cd "$KARAKEEP_LIB_PATH/packages/db"
1111+912export RELEASE NODE_ENV
1010-exec "$KARAKEEP_LIB_PATH/node_modules/.bin/tsx" "$KARAKEEP_LIB_PATH/packages/db/migrate.ts" "$@"
1313+exec "$KARAKEEP_LIB_PATH/node_modules/.bin/drizzle-kit" migrate
···11-Without this change the migrations script will fail if the working directory
22-isn't the same directory this file is located in. To improve usability we
33-specify the migrations folder relative to __dirname, which doesn't depend on the
44-working directory.
55-66----
77---- a/packages/db/migrate.ts
88-+++ b/packages/db/migrate.ts
99-@@ -1,4 +1,5 @@
1010- import { db } from "./drizzle";
1111- import { migrate } from "drizzle-orm/better-sqlite3/migrator";
1212-+import path from "path";
1313-1414--migrate(db, { migrationsFolder: "./drizzle" });
1515-+migrate(db, { migrationsFolder: path.join(__dirname, "./drizzle") });