Skip to content

include.seperate and include.limit support for hasMany - #4177

Merged
mickhansen merged 5 commits into
masterfrom
feat-include-seperate
Jul 27, 2015
Merged

mickhansen merged 5 commits into
masterfrom
feat-include-seperate

Conversation

@mickhansen

Copy link
Copy Markdown
Contributor

No description provided.

To prepare for being able to run a association method on multiple source instances i've moved the association methods to the association prototype
instead of having them on the instance prototype, the instance prototype now only has proxy methods to the methods on the association.
@mickhansen mickhansen changed the title WIP: include.seperate WIP: include.seperate support for hasMany Jul 23, 2015
Comment thread lib/associations/has-many.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

....

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops :D

@mickhansen
mickhansen force-pushed the feat-include-seperate branch from eb0eb7d to e440f26 Compare July 24, 2015 09:53
@mickhansen mickhansen changed the title WIP: include.seperate support for hasMany include.seperate and include.limit support for hasMany Jul 24, 2015
Comment thread lib/model.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that's going to be annoying to change and remember if i constantly misspelled it :D

@SourceBoy

Copy link
Copy Markdown

Hi guys, what does the query look like with

include: [{
  separate: true,
  limit: 5
}]

It looks like it does another query to retrieve associated records rather than retrieving them in one shot?

@mickhansen

Copy link
Copy Markdown
Contributor Author

@SourceBoy The seperate option tells Sequelize to pull it into a seperate query, both to support LIMIT/ORDER'ing of associations but also to counter expensive cartesian products in large joins.

Ideally we still want to support a single query limit of associations, but seperate will go along way :)

@SourceBoy

Copy link
Copy Markdown

Cool. Thanks for the clarification.

Comment thread test/support.js

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@overlookmotel i forgot about this, i'd like to you take a look at some point, but the supportShim severely fucked up during a refactor of HasMany.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mickhansen. Work has quietened down now, so I've got some time to get back on coding. Was planning to finally get round to writing the tests for transaction and CLS context passing.

How did the supportShim fuck up? Happy to have a look and figure it out...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did it start going haywire with this PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall exactly, but the call stack got butchered so i couldn't figure it out, but probably the stubs were no longer correct so tests were failing on the query option association.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, because i refactored the methods in HasMany, so i reckon the stubs need to be fixed, i didn't have the energy for it when i was implementing and then i simply forgot ;p

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK cool. I'll have a look when I get a chance sometime in next couple of weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants