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
docs: Added upsertKeys
property to BulkCreateOptions
interface
#15505
base: main
Are you sure you want to change the base?
Conversation
upsertKeys
property to BulkCreateOptions
interfaceupsertKeys
property to BulkCreateOptions
interface
src/model.d.ts
Outdated
*/ | ||
include?: AllowArray<Includeable>; | ||
upsertKeys?: string[]; |
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.
Can you undo the changes to the order so only upsertKeys
is added?
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.
👍 sure!
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.
yarn lint
changed the orders of the ModelHooks
imports but the pipeline is not passing the lint checks that pass locally.
Am I missing some steps in the PR submission process?
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.
yarn lint
should not do this (the CI is running yarn lint-no-fix
with the same rules), but you are able to undo these changes manually
/** | ||
* Primary key names used as conflict target columns during insertion. | ||
*/ | ||
upsertKeys?: string[]; |
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.
Looking at bulkCreate
it seems that it sets this by itself;
Lines 2251 to 2253 in f6045f8
options.upsertKeys = upsertKeys.length > 0 | |
? upsertKeys | |
: Object.values(model.primaryKeys).map(x => x.field); |
Can you add a test using this option that shows otherwise?
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.
Hi @WikiRik ✋
I'll work on this 💪
Anyway, I've encountered problems after cloning the repo and running yarn install
.
I keep getting this error message:
I searched online but I didn't find anything helpful.
Do you know how I could solve the problem? Should I open a new issue?
Thanks
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.
Can you delete the node_modules folder and try to install it again? If that does not work, you can try opening an issue for the ibm_db project. It's not a sequelize issue
@@ -1,6 +1,6 @@ | |||
import type { ModelHooks } from '@sequelize/core/_non-semver-use-at-your-own-risk_/model-hooks.js'; |
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.
You have lint issues
@@ -1196,6 +1196,11 @@ export interface BulkCreateOptions<TAttributes = any> extends Logging, Transacti | |||
* Return all columns or only the specified columns for the affected rows (only for postgres) | |||
*/ | |||
returning?: boolean | Array<keyof TAttributes | Literal | Col>; | |||
|
|||
/** | |||
* Primary key names used as conflict target columns during insertion. |
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.
* Primary key names used as conflict target columns during insertion. | |
* Column names used as conflict target columns during insertion. | |
* Defaults to the primary keys of the model. |
Pull Request Checklist
Description Of Change
Added documentation for the
upsertKeys
option in theBulkCreateOptions
interface.fix #15226