Note
If you still have the CLOUDFLARE_D1_DATABASE_ID, CLOUDFLARE_D1_BEARER_TOKEN and CLOUDFLARE_ACCOUNT_ID variables in .dev.vars, you can delete those and follow this guide instead
Cloud Sync uses an SQL D1 database with the name of VendettaCloudSync1 to store user data.
-
Pick a name and location (optional) for the database
- You can list the available locations by running
bunx wrangler d1 create
- You can list the available locations by running
-
Create the database
$ bunx wrangler d1 create [name] --location [location]
-
Copy the
database_nameanddatabase_idvalues from the previous command and replace them inwrangler.jsonc- You may notice the database is there twice, which is intentional because otherwise wrangler shouts at me during development
-
Initialize the database both locally (miniflare) and on the real database
$ bunx wrangler d1 execute DB --local --file ./schema.sql $ bunx wrangler d1 execute DB --remote --yes --file ./schema.sql
-
You're done!
Footnotes
-
from the ye olden days, which is why it doesn't follow the naming convention (cloudflare doesn't let you rename databases for whatever reason) ↩