Files
payloadcms/packages/db-d1-sqlite
Sasha 444ca0f439 fix(db-d1-sqlite): avoid bound parameter limit when querying relationships and inserting rows (#14099)
Fixes
https://discord.com/channels/967097582721572934/1422639568808841329/1425037080051978261

This PR avoids bound parameters usage for `IN` and `NOT_IN` querying on
`id` to respect the D1 limit
https://developers.cloudflare.com/d1/platform/limits/
And also batches inserts when inserting arrays/blocks/hasMany
relationships etc. This is needed because we can't avoid using bound
parameters there, but still want to respect the 100 variables limit per
query.
2025-10-07 13:55:44 +00:00
..
2025-09-30 09:22:02 -04:00

Payload D1 SQLite Adapter

Official D1 SQLite adapter for Payload.

Installation

npm install @payloadcms/db-d1-sqlite

Usage

import { sqliteD1Adapter } from '@payloadcms/db-d1-sqlite'

export default buildConfig({
  // Your config goes here
  collections: [
    // Collections go here
  ],
  // Configure the D1 adapter here
  db: sqliteD1Adapter({
    // D1-specific arguments go here.
    // `binding` is required and should match the D1 database binding name in your Cloudflare Worker environment.
    binding: cloudflare.env.D1,
  }),
})

More detailed usage can be found in the Payload Docs.