prisma-adapter-node-sqlite
v0.0.1
Published
Prisma adapter for native `node:sqlite` database
Maintainers
Readme
prisma-adapter-node-sqlite
This is a Prisma adapter for the native node:sqlite database. It is heavily inspired by the @prisma/adapter-better-sqlite3 adapter.
Installation
$ npm i prisma-adapter-node-sqliteConnection details
datasource db {
provider = "sqlite"
url = "file:./dev.db"
}Instantiation
import { PrismaNodeSQLite } from 'prisma-adapter-node-sqlite';
const adapter = new PrismaNodeSQLite({
url: 'file:./prisma/dev.db',
});
const prisma = new PrismaClient({ adapter });Configure timestamp format for backward compatibility
import { PrismaNodeSQLite } from 'prisma-adapter-node-sqlite';
const adapter = new PrismaNodeSQLite(
{
url: 'file:./prisma/dev.db',
},
{ timestampFormat: 'unixepoch-ms' }
);
const prisma = new PrismaClient({ adapter });When to use each format:
ISO 8601 (default): Best for new projects and integrates well with SQLite's built-in date/time functions.unixepoch-ms: Required when migrating from Prisma ORM's native SQLite driver to maintain compatibility with existing timestamp data.
Native type mapping from Prisma ORM to node:sqlite
| Prisma ORM | node:sqlite |
| ---------- | ------------- |
| String | TEXT |
| Boolean | BOOLEAN |
| Int | INTEGER |
| BigInt | INTEGER |
| Float | REAL |
| Decimal | DECIMAL |
| DateTime | NUMERIC |
| Json | JSONB |
| Bytes | BLOB |
| Enum | TEXT |
