-
Notifications
You must be signed in to change notification settings - Fork 49
fix: fix record creation with unconventional pk field acting as a fk #598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix record creation with unconventional pk field acting as a fk #598
Conversation
1469c4d
to
bf4760f
Compare
}); | ||
|
||
_.remove(fields, (field) => | ||
_.includes(fieldNamesToExclude, field.columnName) && !field.primaryKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
primaryKey
does not exist, but isPrimaryKey
does.
Neithertheless, we still need to remove it for a better user experience.
effb94e
to
84735fd
Compare
92d9a9d
to
19fd728
Compare
a516d3d
to
ad3d704
Compare
exports.primaryKeyIsForeignKey = (association) => | ||
Object.values(association.source.rawAttributes).filter((attr) => | ||
attr.field === association.source.primaryKeyField).length > 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PROPOSAL] Knowing this will be the only one function of the this file, we might want to export it as it is, and packed in an object.
module.exports = (association) => ..
0c252ff
to
c0317d8
Compare
34b876b
to
f684229
Compare
## [6.7.9](v6.7.8...v6.7.9) (2021-02-22) ### Bug Fixes * fix record creation with unconventional pk field acting as a fk ([#598](#598)) ([d3779b7](d3779b7))
🎉 This PR is included in version 6.7.9 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [7.0.0-beta.11](v7.0.0-beta.10...v7.0.0-beta.11) (2021-02-22) ### Bug Fixes * fix record creation with unconventional pk field acting as a fk ([#598](#598)) ([d3779b7](d3779b7)) * support foreign and primary key column ([#630](#630)) ([2a289b8](2a289b8)) * **search:** don't convert float values to bigint ([75c1517](75c1517)) * **search:** handle large numbers in search queries ([c0c1c70](c0c1c70)) * **search:** handle large numbers in search queries ([#621](#621)) ([ec6ab89](ec6ab89)) * **search:** handle tables that contain floats and bigints ([7ac2fe1](7ac2fe1)) * **search:** revert changes when numbers are below MAX_SAFE_INTEGER ([1d95021](1d95021))
🎉 This PR is included in version 7.0.0-beta.11 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This Pr works with:
How to test?
Please follow in the right order theses steps, as there is still an issue with the forestadmin-server update
fix-primary-foreign-key-to-primary-key
on every projectsyarn build:watch
yarn link forest-express
, thenyarn build:watch
- BE CAREFUL HERE
forest-express-sequelize
withyarn link forest-express-sequelize
Pull Request checklist: