fresh
Drop all tables and re-run every migration from scratch.
Data Loss
fresh drops all tables and re-runs all migrations. All data is permanently deleted. Only use this command on local or development databases. Never run it against a production database.
Synopsis
bash
bunx d1-eloquent fresh [--db <DB_NAME>] [--remote]Options
| Flag | Description |
|---|---|
--db <DB_NAME> | Optional. Auto-detected from wrangler.toml, falls back to 'DB'. |
--local | Run against the local D1 database. This is the default. Recommended — keep fresh local. |
--remote | Run against the Cloudflare-hosted D1 database. Use with extreme caution. |
Example
Reset the local database and apply all migrations from scratch:
bash
bunx d1-eloquent freshNotes
freshis equivalent to dropping every table manually and then runningmigrate.- The
_migrationstracking table is also cleared, so every migration file will be treated as new. - After
fresh, runseedto repopulate the database with development data.