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 bulk create not inserting NULL for undefined values. Fixes #3670 #3729

Merged
merged 1 commit into from May 17, 2015

Conversation

2 participants
@BridgeAR
Contributor

BridgeAR commented May 16, 2015

No description provided.

@mickhansen

This comment has been minimized.

Contributor

mickhansen commented May 16, 2015

The description is misleading, does it fix it so it will no longer insert null values or will do it again.

@@ -1337,7 +1337,9 @@ module.exports = (function() {
// Filter dataValues by options.fields
var values = {};
options.fields.forEach(function(field) {
values[field] = instance.dataValues[field];

This comment has been minimized.

@mickhansen

mickhansen May 16, 2015

Contributor

This should probably just use the method from utils instead for mapping fields.

This comment has been minimized.

@BridgeAR

BridgeAR May 16, 2015

Contributor

I'll check that. I played around with this quite a bit, since I was not really happy with that solution (I came up with this after around three minutes and tried other stuff for at least an hour...).
I tried not to use fields all the time (that's not necessary at all) but couldn't find a good working solution.

style: 'ipa'
}], {
logging: function(sql) {
if (dialect === 'postgres') {

This comment has been minimized.

@mickhansen

mickhansen May 16, 2015

Contributor

Really don't want to add more sql testing in the integration tests, we're trying to remove it as much as possible.

This comment has been minimized.

@BridgeAR

BridgeAR May 16, 2015

Contributor

I thought so, but for me it was to late in the night and fast to write 😊
I'll change it later

This comment has been minimized.

@BridgeAR

BridgeAR May 16, 2015

Contributor

Hm while thinking about it: A unit test would not help here. It's not really about the SQL generation but what happens earlier on. I could refactor the bulkInsertQuery, but I doubt that this would be the wanted solution.

This comment has been minimized.

@mickhansen

mickhansen May 17, 2015

Contributor

If it's not about the sql don't test the sql ;)

This comment has been minimized.

@mickhansen

mickhansen May 17, 2015

Contributor

Perhaps do a test against a table with NOT NULL fields but with default values on the db side (not in sequelize since we then provide it).

@BridgeAR

This comment has been minimized.

Contributor

BridgeAR commented May 16, 2015

Ready for merge. This should actually speed up very big bulkCreates 😃

@mickhansen mickhansen merged commit 7fc6f21 into sequelize:master May 17, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment