npx wrangler d1 execute my-db --remote --command "DELETE FROM sessions"

Category: Cloudflare

npx wrangler d1 execute my-db --remote --command "DELETE FROM sessions"

Run SQL against the production D1 database

The --remote flag targets the live production database instead of the local copy, so statements like DELETE FROM sessions take effect immediately. Destructive SQL here is irreversible without a restore, so test against local first. Consider `wrangler d1 time-travel restore` as your safety net.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.