Cloudflare Worldedge community field guide

RETROSPECTIVE EDITION / 2024-09

D1: let the schema carry the contract

Relational data needs migrations, constraints, query ownership, and recovery—not only a SQL endpoint.

ISSUE
09 / 32
FIRST PUBLISHED
SOURCE CHECKED
Archive integrity

The edition month is a curriculum position. This article was first published on 2026-08-10 and is not presented as a historical release or past activity.

01 / DECISION

When this primitive earns a place

Use D1 when relationships and SQL queries are central and the application can own a deliberate schema lifecycle.

02 / ARCHITECTURE

Build the smallest defensible path

Start with constraints and indexes, write forward migrations, bind prepared statements, paginate reads, and define backup and deletion behavior.

  1. 01Name the contract

    Use D1 when relationships and SQL queries are central and the application can own a deliberate schema lifecycle.

  2. 02Add one primitive

    Start with constraints and indexes, write forward migrations, bind prepared statements, paginate reads, and define backup and deletion behavior.

  3. 03Capture failure evidence

    Apply migrations to a disposable database, test constraints and empty results, inspect query plans, and rehearse restore or rebuild.

03 / REPRODUCE

Evidence before confidence

Apply migrations to a disposable database, test constraints and empty results, inspect query plans, and rehearse restore or rebuild.

npx wrangler d1 migrations apply DB --local

04 / BOUNDARY

The production boundary

A database binding does not remove query cost, contention, migration risk, or the need to minimize collected data.

05 / FIRST-PARTY SOURCES

Keep first-party sources authoritative

Product behavior, limits, pricing, and availability can change. Re-check these sources before acting.

01 / SOURCECloudflare D1https://developers.cloudflare.com/d1/