loopbackio / loopbackio/loopback-next
npm run migrate : cannot migrate models not attached to this datasource, while having model sequencing in migrate.ts
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- TypeScript
- Star
- 5.1k
- Fork
- 1.1k
- Merge trung bình
- 2 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 27
Mô tả
- Visited https://loopback.io/doc/en/lb4/todo-list-tutorial-sqldb.html - #link1
-Visited https://loopback.io/doc/en/lb4/MySQL-connector.html - #link2
Steps to reproduce
-
Intstall @loopback/authentication @loopback/authentication-jwt extensions
-
Suppose you are using Relational database, using the constraints as foreign keys, so you to sequence the model in migrate.ts as guided on #link1 above like
models:[...model, ...relatedmodel]
**Note if you dont have key constraints and this model sequencing, it work fine. no error -
Then bind the authentication-jwt datasource in to your application.ts
this.datasource(YourDbDatasource, UserServiceBindings.DATASOURCE_NAME) -
when you run migrate.
`
npm run clean
npm run build
npm run migrate
`
Error Come in action
Cannot migrate database schema Error: Cannot migrate models not attached to this datasource:
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với migrate.ts và application.ts, sau đó tái hiện lỗi đã báo cáo bằng npm run clean, npm run build và npm run migrate sau khi liên kết datasource authentication-jwt. Truy vết lý do các model được tuần tự hóa bị báo cáo là chưa được gắn kết, và coi issue là hoàn tất khi thiết lập relational-model được tài liệu hóa có thể migrate mà không gặp lỗi đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- nodejs, typescript
- Lĩnh vực
- backend, databases
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 35/100