Skip to content
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

Repro case for scoped findAndCountAll failure #253

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nrabinowitz
Copy link

I have two models (in the example, FooModel and OtherModel). FooModel has a hasMany association with OtherModel, with a scope that references an aliased column (i.e. a DB column with a different name from the model attribute).

Selecting FooModel instances using findAll and including OtherModel works as expected. However, when using findAndCountAll, invalid SQL is generated, because the column alias is not resolved, and the query fails with an error:

DatabaseError [SequelizeDatabaseError]: SQLITE_ERROR: no such column: OtherModels.modelType

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.

1 participant