D1 Best Practices dev/prod modes and --local and --remote flags
Hi!
What are best practices around databases with D1 for building web apps that have dev and prod modes?
I tried creating a wrangler.toml like this:
notice the ids are the same.
when I create migrations, I have to use --env=dev and --env=prod flags. But not I have duplicated migrations in the same folder.
What's the right way to do this? Should I have two databases in each env? A dev and a prod?
Or should I control using the --local and --remote flags somehow?
1 Reply
just found this, which looks to be using 2 separate databases.
https://developers.cloudflare.com/d1/configuration/environments/
what is the difference between managing it like this vs. using --local and --dev flags?
Cloudflare Docs
Environments · Cloudflare D1 docs
Environments are different contexts that your code runs in. Cloudflare Developer Platform allows you to create and manage different environments. …