Skip to main content

Database Drivers

Verse supports many different databases through database driver plugins.

Supported Database Drivers

Verse currently supports the following database drivers:

DatabasePackageFunction
PostgreSQL@operativa/verse-postgrespostgres
MySQL@operativa/verse-mysqlmysql
SQLite@operativa/verse-sqlitesqlite
SQL Server@operativa/verse-mssqlmssql
Oracle@operativa/verse-oracleoracle

Using a Database Driver

To use a database driver:

  1. install the package for the database you want to use
  2. add the import for the driver
  3. add the driver to your verse function

In this example, we would like to use SQLite.

You would install the SQLite driver, @operativa/verse-sqlite:

npm install @operativa/verse-sqlite

You would then add the import for the driver and initialize it in your verse function:

import { verse } from "@operativa/verse";
import { sqlite } from "@operativa/verse-sqlite";
import { boolean, entity, int, string } from "@operativa/verse/model/builder";

const db = verse({
config: {
driver: sqlite("todos.sqlite"),
},
model: {
entities: {
todos: entity({
id: int(),
title: string(),
completed: boolean(),
}),
},
},
});