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

Composite key on hasMany relation gives error #106

Closed
lroal opened this issue Jun 10, 2024 · 0 comments
Closed

Composite key on hasMany relation gives error #106

lroal opened this issue Jun 10, 2024 · 0 comments
Labels

Comments

@lroal
Copy link
Member

lroal commented Jun 10, 2024

orange Version

4.1.1

Database

None

Database Version

No response

Operating System

No response

Description

TypeError: Cannot read properties of undefined (reading '_primaryColumns')
❯ primaryKeyFilter ../src/table/newPrimaryKeyFilter.js:2:29
❯ createCompositeFilter ../src/getManyDto.js:220:36
❯ createOneFilter ../src/getManyDto.js:217:10

const map = orange.map(x => ({
   compositeOrder: x.table('compositeOrder').map(({ column }) => ({
   	companyId: column('companyId').string().primary().notNullExceptInsert(),
   	orderNo: column('orderNo').numeric().primary().notNullExceptInsert(),
   })),

   compositeOrderLine: x.table('compositeOrderLine').map(({ column }) => ({
   	companyId: column('companyId').string().primary().notNullExceptInsert(),
   	orderNo: column('orderNo').numeric().primary().notNullExceptInsert(),
   	lineNo: column('lineNo').numeric().primary().notNullExceptInsert(),
   	product: column('product').string(),
   }))
})).map(x => ({	
   compositeOrder: x.compositeOrder.map(({ hasMany }) => ({
   	lines: hasMany(x.compositeOrderLine).by('companyId', 'orderNo')
   }))

}));

export default map;

Expected Behavior

No response

@lroal lroal added the bug label Jun 10, 2024
lroal pushed a commit that referenced this issue Jun 10, 2024
@lroal lroal closed this as completed in 639e516 Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant