ework-daemon 0.4.8 → 0.4.10

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/db.ts +8 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-daemon",
3
- "version": "0.4.8",
3
+ "version": "0.4.10",
4
4
  "description": "Issue-driven AI development daemon. Spawns opencode subprocesses to resolve Gitea issues.",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",
package/src/db.ts CHANGED
@@ -96,6 +96,7 @@ class SqliteDriver implements AsyncDatabase {
96
96
  const db = new Database(DB_PATH, { create: true, readwrite: true });
97
97
  db.exec("PRAGMA journal_mode = WAL");
98
98
  db.exec("PRAGMA foreign_keys = ON");
99
+ db.exec("PRAGMA busy_timeout = 5000");
99
100
  const schemaSql = applyPrefix(readFileSync(join(import.meta.dir, "schema-sqlite.sql"), "utf8"));
100
101
  db.exec(schemaSql);
101
102
  return new SqliteDriver(db);
@@ -320,7 +321,13 @@ async function runMigrations(db: AsyncDatabase): Promise<void> {
320
321
 
321
322
  const ensureColumn = async (table: string, col: string, ddl: string): Promise<void> => {
322
323
  if (await hasColumn(table, col)) return;
323
- await db.exec(`ALTER TABLE ${table} ADD COLUMN ${ddl}`);
324
+ try {
325
+ await db.exec(`ALTER TABLE ${table} ADD COLUMN ${ddl}`);
326
+ } catch (e) {
327
+ const errno = (e as { errno?: number }).errno;
328
+ if (errno === 1060 || errno === 30000) return;
329
+ throw e;
330
+ }
324
331
  };
325
332
 
326
333
  // ── id/uid swap: id becomes AUTO_INCREMENT PK, uid holds the UUID ──