Skip to content

db init

Scaffold the mini-ORM at src/helpers/db.ts. Idempotent — safe to run again.

Terminal window
vsceasy db init

Flags

FlagTypeNotes
--providerstorage | globalWhere data lives. Default storage.
--forcebooleanOverwrite an existing db.ts.

Providers

  • storage — writes under the workspace storage dir. Falls back to global storage automatically when no folder is open (so activation never fails).
  • global — writes under the global storage dir, shared across workspaces.

Wire it on activate

src/extension/extension.ts
import { bootstrap } from '../shared/vsceasy';
import { registry } from './_registry';
import { initDb } from '../helpers/db';
export const activate = bootstrap(registry, { onActivate: [initDb] });

Next: define a model, then use it via its repo. See the mini-ORM guide for the full API.