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
npx @orphnet/d1-eloquent fresh --db <DB_NAME> [--local | --remote]Options
| Flag | Description |
|---|---|
--db <DB_NAME> | Required. The D1 binding name defined in wrangler.toml. |
--local | Run against the local D1 database. 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
npx @orphnet/d1-eloquent fresh --db MY_DB --localNotes
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.