Skip to content

Upgrade Guide

  1. Preparation: It is recommended that developers create a new project branch for this upgrade.
  2. Upgrade dependency package versions: npm i ee-bin@latest -D && npm i ee-core@latest
  3. Adjust configuration files:
  4. Adjust package.json configuration, refer to package.json
  5. Remove string identifiers like '[class ExampleController]' from js/ts files. These are no longer needed in v5.
  6. SqliteStorage lazy load migration: constructor no longer opens the database connection. The native better-sqlite3 binding is now lazily loaded via init(), avoiding unconditional module loading for projects that don't use SQLite.

Affected code:

Before (v4)After (v5 latest)
new SqliteStorage(name, options) — constructor opens DBnew SqliteStorage(name) — constructor only computes paths
this.db = this.storage.db available immediatelyawait this.storage.init(options) — must call before using this.db
basedbService._init() — synchronousbasedbService._init() — now async, returns Promise<void>
preload() — synchronouspreload() — now async, returns Promise<void>
import Database from 'better-sqlite3' — loaded at import timeimport type Database from 'better-sqlite3' — type-only; real import deferred to init()

Migration steps:

  1. Change SqliteStorage constructor calls: remove the second options argument
  2. Call await storage.init(options) after construction, before accessing storage.db
  3. Update any code that was synchronous around DB initialization to use async/await
  4. If using basedbService, the _init() and changeDataDir() methods are now async — add await
  5. If using the preload() function, it is now async — add await

Example:

javascript
// Before
const storage = new SqliteStorage('myapp.db', { timeout: 6000 });
const db = storage.db;

// After
const storage = new SqliteStorage('myapp.db');
await storage.init({ timeout: 6000 });
const db = storage.db;

// Or chaining
const { db } = await new SqliteStorage('myapp.db').init({ timeout: 6000 });