Interface StorageOpenOptions

Options accepted when opening a storage adapter.

interface StorageOpenOptions {
    filePath?: string;
    connectionString?: string;
    readOnly?: boolean;
    adapterOptions?: Record<string, unknown>;
    foreignKeys?: boolean;
}

Hierarchy (view full)

Properties

filePath?: string

Absolute path to the primary database file (when applicable).

connectionString?: string

Connection string (PostgreSQL, etc.).

readOnly?: boolean

Optional flag to force read-only mode.

adapterOptions?: Record<string, unknown>

Arbitrary adapter-specific options bag.

foreignKeys?: boolean

SQLite: true turns foreign-key enforcement on and false turns it off (PRAGMA foreign_keys) when the adapter opens. On sql.js and IndexedDB it holds when sql.js reopens its connection (a save, an export, an import), as a PRAGMA foreign_keys statement run later does. Left out, each engine keeps its default: better-sqlite3 is built with SQLITE_DEFAULT_FOREIGN_KEYS=1 and enforces them, and the Capacitor plugin turns them on when it opens a database; sql.js and IndexedDB do not. PostgreSQL always enforces foreign keys and ignores this.