cloudflare / cloudflare/developer-platform
Exporting and importing locally gives "no such table: main.User: SQLITE_ERROR"
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 1
- Fork
- 0
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
### 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.
### Please provide any relevant error logs
[wrangler-2025-05-23_10-58-30_040.log](https://github.com/user-attachments/files/20409177/wrangler-2025-05-23_10-58-30_040.log)
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với các lệnh `wrangler d1 export` và `wrangler d1 execute --file` đã được ghi lại trong tài liệu, sau đó kiểm tra `database.sql` được tạo và nhật ký Wrangler được liên kết. Xác minh xem các câu lệnh bảng đã xuất có được sắp xếp an toàn theo các dependency của chúng hay không, và coi quá trình import là hoàn tất khi tệp SQL thực thi thành công trên cơ sở dữ liệu staging.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- sql, sqlite
- Lĩnh vực
- databases
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100