Incremental migration does not configure existing PK column to enable auto-generated values
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js, postgresql
Hướng nghiên cứu
Tái hiện vấn đề trong ứng dụng todo loopback-next bằng branch postgres-pk-auto-gen được liên kết và hai commit của branch đó. Chạy npm migrate trước và sau khi bật generated: true, sau đó xác nhận liệu việc tạo một todo không có ID có thành công hay không và ID có được tự động tạo hay không.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description/Steps to reproduce
From my testing using LoopBack 4 and this connector, the migration performed by npm run migrate does not configure the id (primary key) column to be auto-generated when generated: true is enabled on the property.
Link to reproduction sandbox
I've set up a branch on my loopback-next fork with a recreate. The branch is here:
https://github.com/aharbis/loopback-next/tree/postgres-pk-auto-gen
The recreate uses the todo application. There are two commits on the branch:
https://github.com/aharbis/loopback-next/commit/cdee3cb60305a02e5e1e5a49069e043079615289 - Adds the Postgres data source
https://github.com/aharbis/loopback-next/commit/43368cc4687521f06a79102b6484494cda6e27be - Sets generated: true on todo model
Steps to recreate
- Checkout first commit (that adds the datasource)
- Install dependencies (
npm i) - Run migration (
npm run migrate) - Start app (
npm start) - Try to create todo with ID, to confirm this works
- Stop app
- Checkout second commit (that sets
generated: true) - Run migration (
npm run migrate) - Start app (
npm start) - Try to create todo without ID
Expected result
In step 10, this create should succeed and the ID should be auto-generated.
Actual result
In step 10, this create yields a 500 error:
Unhandled error in POST /todos: 500 error: null value in column "id" violates not-null constraint
at Connection.parseE (/Users/aharbis/git/loopback-next/examples/todo/node_modules/pg/lib/connection.js:602:11)
at Connection.parseMessage (/Users/aharbis/git/loopback-next/examples/todo/node_modules/pg/lib/connection.js:399:19)
at Socket.<anonymous> (/Users/aharbis/git/loopback-next/examples/todo/node_modules/pg/lib/connection.js:121:22)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:601:20)
Additional information
$ node -e 'console.log(process.platform, process.arch, process.versions.node)'
darwin x64 8.12.0
$ npm ls --prod --depth 0 | grep loopback
@loopback/[email protected] /Users/aharbis/git/loopback-next/examples/todo
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── [email protected]
└── [email protected]
$ psql --version
psql (PostgreSQL) 10.5
- Ngôn ngữ chính
- JavaScript
- Star
- 118
- Fork
- 183
- Merge trung bình
- 3 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc 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.
Issue khác của loopbackio/loopback-connector-postgresql
-
Partial JSON UpdateCó thể đã có người làm @vaibhavbhalla2505 đã nhận 264 ngày trước. Đang mởfeature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
loopbackio/loopback-connector-postgresql#748 · 1 bình luận ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
loopbackio/loopback-connector-postgresql#732 · 1 bình luận ·
Tất cả issue của loopbackio/loopback-connector-postgresql
Issue tương tự
-
Progress difficulty filter lists Hard before MediumCó thể đã có người làm @Pandamachi đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
sysprog21/codetrial#281 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[dsh-plugin.org | dsh-plugin-hub] plugin distribution incomplete: yjh051108/dsh-routing-suiteĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 71/100
yjh051108/dsh-routing-suite#227 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
needs-triage release-watch
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
remoteintech/remote-jobs#2271 ·
Maintainer thường phản hồi trong vòng 1 ngày