Skip to content

Initialize/Update D1 Database ​

Create Database ​

Open the Cloudflare console, select Storage & Databases -> D1 SQL Database -> Create Database, and click to create the database.

d1

After creation, we can see the D1 database in the Cloudflare console.

Initialize Database ​

Note

You can also skip initializing the database and after deployment is complete, go to the admin page's Quick Setup -> Database section and click the Initialize Database button to initialize the database.

Open the Console tab, enter the content from the db/schema.sql file in the repository, and click Execute to run it.

d1

Update Database Schema ​

For schema updates, please confirm the version you previously deployed.

Check the Changelog

Find the patch file that needs to be executed, for example: db/2024-01-13-patch.sql

Open the Console tab, enter the content of the patch file, and click Execute to run it.

d1

Based on MIT license