bgrun 3.12.6 → 3.12.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -629,6 +629,10 @@ import { Database, z } from "sqlite-zod-orm";
629
629
  import { join as join2 } from "path";
630
630
  var {sleep } = globalThis.Bun;
631
631
  import { existsSync as existsSync3, copyFileSync as copyFileSync2 } from "fs";
632
+ function shouldAutoMigrateLegacyDb() {
633
+ const raw = (process.env.BGRUN_DISABLE_LEGACY_MIGRATION || "").trim().toLowerCase();
634
+ return !(raw === "1" || raw === "true" || raw === "yes");
635
+ }
632
636
  function getProcess(name) {
633
637
  return db.process.select().where({ name }).orderBy("timestamp", "desc").limit(1).get() || null;
634
638
  }
@@ -883,7 +887,7 @@ var init_db = __esm(() => {
883
887
  dbPath = join2(bgrDir, dbFilename);
884
888
  bgrHome = bgrDir;
885
889
  legacyDbPath = join2(bgrDir, "bgr_v2.sqlite");
886
- if (!existsSync3(dbPath) && existsSync3(legacyDbPath)) {
890
+ if (shouldAutoMigrateLegacyDb() && !existsSync3(dbPath) && existsSync3(legacyDbPath)) {
887
891
  try {
888
892
  copyFileSync2(legacyDbPath, dbPath);
889
893
  console.log(`[bgrun] Migrated database: ${legacyDbPath} \u2192 ${dbPath}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bgrun",
3
- "version": "3.12.6",
3
+ "version": "3.12.8",
4
4
  "description": "bgrun — A lightweight process manager for Bun",
5
5
  "type": "module",
6
6
  "main": "./src/api.ts",
package/src/db.ts CHANGED
@@ -65,9 +65,14 @@ const dbFilename = process.env.BGRUN_DB ?? "bgrun.sqlite";
65
65
  export const dbPath = join(bgrDir, dbFilename);
66
66
  export const bgrHome = bgrDir;
67
67
 
68
+ function shouldAutoMigrateLegacyDb() {
69
+ const raw = (process.env.BGRUN_DISABLE_LEGACY_MIGRATION || '').trim().toLowerCase();
70
+ return !(raw === '1' || raw === 'true' || raw === 'yes');
71
+ }
72
+
68
73
  // Auto-migration: if new DB doesn't exist but old one does, copy it over
69
74
  const legacyDbPath = join(bgrDir, "bgr_v2.sqlite");
70
- if (!existsSync(dbPath) && existsSync(legacyDbPath)) {
75
+ if (shouldAutoMigrateLegacyDb() && !existsSync(dbPath) && existsSync(legacyDbPath)) {
71
76
  try {
72
77
  copyFileSync(legacyDbPath, dbPath);
73
78
  console.log(`[bgrun] Migrated database: ${legacyDbPath} → ${dbPath}`);