Draw Cloudflare D1 Schemas From the Remote Database, Not the Local File

A guide on Cloudflare's D1 database explains that a project's schema can exist in three places: migration files, a local SQLite file, and the deployed database. Running wrangler d1 migrations apply without the --remote flag writes changes only to the local file, so the two can silently diverge. In the author's test with wrangler 4.151.3, the local file had a table that production lacked, while production had an index missing locally. The author argues that a schema diagram should reflect the remote database, since that represents what is live, while the local file only shows what a branch is about to ship. A SQL export is accurate only as of the moment it was taken.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in