workers-sdk
workers-sdk copied to clipboard
Exporting and importing locally gives "no such table: main.User: SQLITE_ERROR"
What versions & operating system are you using?
wrangler 4.16.1
Please provide a link to a minimal reproduction
No response
Describe the Bug
I follow this article how to export and import d1. https://developers.cloudflare.com/d1/best-practices/import-export-data/#export-an-existing-d1-database
npx wrangler d1 export xyz --remote --output=./database.sql
I remove rm -rf .wrangler
and then running
npx wrangler@latest d1 execute xyz-staging --file=database.sql
The sql file looks correct, but it looks like the export is not doing it correct in order
You can see that _userOrganizations depends on User which has not been created yet, and if I switch the order then I get another SQL error about another table which does not exist.