3. Create the database (D1)¶
The app stores everything (people, schedule, holidays, time off, users) in a Cloudflare D1 database. D1 is a SQLite database that lives in your Cloudflare account. You create it once.
It may already exist
The project's wrangler.toml already contains a database_id. If that database still exists in this Cloudflare account, you can skip creating a new one and just confirm the ID matches (see the bottom of this page). Create a new one only if you're setting up a fresh Cloudflare account.
Create the database¶
In the oncall-scheduler folder, run:
Wrangler prints a short block of text that includes a database_id — a long string that looks like:
Copy that whole database_id value. You need it in the next step.
Paste the ID into wrangler.toml¶
- Open the file
wrangler.tomlin theoncall-schedulerfolder with any text editor (Notepad is fine). -
Find the section that looks like this:
-
Replace the value after
database_id =with the ID you just copied (keep the quotes). - Save the file.
The binding name must stay DB
Don't change binding = "DB" — the app's code looks for a binding called DB. Only change the database_id.
What this file does¶
wrangler.toml is the app's configuration. The important parts:
name = "oncall-scheduler"
compatibility_date = "2025-06-01"
pages_build_output_dir = "client/dist"
[[d1_databases]]
binding = "DB"
database_name = "oncall_db"
database_id = "…your id…"
[vars]
APP_ENV = "production"
DEFAULT_SCHEDULE_WEEK_START = "wednesday"
ADMIN_EMAILS = "robertbettencourt@totlcom.com"
pages_build_output_dirtells Cloudflare where the built website ends up.[[d1_databases]]connects the app to your database.[vars]holds non-secret settings — covered on the Environment variables page.
You won't create the tables yet — that happens in Run database migrations, after the project is connected to Cloudflare. For now, you just need the database to exist and its ID to be in wrangler.toml.
Confirm the database exists¶
You should see oncall_db in the list.