···67[[ -d "$DATA_DIR" ]] # Ensure DATA_DIR is defined and exists
80009export RELEASE NODE_ENV
10-exec "$KARAKEEP_LIB_PATH/node_modules/.bin/tsx" "$KARAKEEP_LIB_PATH/packages/db/migrate.ts" "$@"
···67[[ -d "$DATA_DIR" ]] # Ensure DATA_DIR is defined and exists
89+# Drizzle will look for configuration in the working directory
10+cd "$KARAKEEP_LIB_PATH/packages/db"
11+12export RELEASE NODE_ENV
13+exec "$KARAKEEP_LIB_PATH/node_modules/.bin/drizzle-kit" migrate
+4-1
pkgs/by-name/ka/karakeep/helpers/start-workers
···2set -eu -o pipefail
3KARAKEEP_LIB_PATH=
4RELEASE=
05NODE_ENV=production
6NODE_PATH="$KARAKEEP_LIB_PATH/apps/workers"
78[[ -d "$DATA_DIR" ]] # Ensure DATA_DIR is defined and exists
90010export RELEASE NODE_ENV NODE_PATH
11-exec "$KARAKEEP_LIB_PATH/node_modules/.bin/tsx" "$KARAKEEP_LIB_PATH/apps/workers/index.ts"
···2set -eu -o pipefail
3KARAKEEP_LIB_PATH=
4RELEASE=
5+NODEJS=
6NODE_ENV=production
7NODE_PATH="$KARAKEEP_LIB_PATH/apps/workers"
89[[ -d "$DATA_DIR" ]] # Ensure DATA_DIR is defined and exists
1011+cd "$KARAKEEP_LIB_PATH/apps/workers"
12+13export RELEASE NODE_ENV NODE_PATH
14+exec "$NODEJS/bin/node" "$KARAKEEP_LIB_PATH/apps/workers/dist/index.js"
···1-Without this change the migrations script will fail if the working directory
2-isn't the same directory this file is located in. To improve usability we
3-specify the migrations folder relative to __dirname, which doesn't depend on the
4-working directory.
5-6----
7---- a/packages/db/migrate.ts
8-+++ b/packages/db/migrate.ts
9-@@ -1,4 +1,5 @@
10- import { db } from "./drizzle";
11- import { migrate } from "drizzle-orm/better-sqlite3/migrator";
12-+import path from "path";
13-14--migrate(db, { migrationsFolder: "./drizzle" });
15-+migrate(db, { migrationsFolder: path.join(__dirname, "./drizzle") });