Alpha database migration guide
D1’s open beta launched in October 2023, and newly created databases use a different underlying architecture that is significantly more reliable and performant, with increased database sizes, improved query throughput, and reduced latency.
This guide will instruct you to recreate alpha D1 databases on our production-ready system.
1. Verify that a database is alpha
If the database is alpha, the output of the command will include version set to alpha:
2. Create a manual backup
3. Download the manual backup
The command below will download the manual backup of the alpha database as .sqlite3 file:
4. Convert the manual backup into SQL statements
The command below will convert the manual backup of the alpha database from the downloaded .sqlite3 file into SQL statements which can then be imported into the new database:
Once you have run the above command, you will need to edit the output SQL file to be compatible with D1:
-
Remove
BEGIN TRANSACTIONandCOMMIT;from the file. -
Remove the following table creation statement:
5. Create a new D1 database
All new D1 databases use the updated architecture by default.
Run the following command to create a new database:
6. Run SQL statements against the new D1 database
7. Delete your alpha database
To delete your previous alpha database, run: