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.
- You have the
wrangler
command-line tool installed - You are using
wrangler
version3.33.0
or later (released March 2024) as earlier versions do not have the--remote
flag required as part of this guide - An ‘alpha’ D1 database. All databases created before July 27th, 2023 (release notes) use the alpha storage backend, which is no longer supported and was not recommended for production.
If the database is alpha, the output of the command will include version
set to alpha
:
The command below will download the manual backup of the alpha database as .sqlite3
file:
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 TRANSACTION
andCOMMIT;
from the file. -
Remove the following table creation statement:
All new D1 databases use the updated architecture by default.
Run the following command to create a new database:
To delete your previous alpha database, run: