Bad pagination parameters
bcomnes opened this issue · 1 comments
bcomnes commented
When requesting commerce/users?per_page=50&page=1
on the staging instance, I get back the following error:
Error loading customers: {code: 400, msg: "Bad Pagination Parameters: Error 1054: Unknown column 'test_orders.user_id' in 'on clause'"}
This could very much be a botched migration or some other manual thing we need to do.
bcomnes commented
Matt Biilmann [8:09 PM]
ahh, the query here is broken:
query = query.
Joins("LEFT JOIN " + orderTable + " as orders ON " + userTable + ".id = " + orderTable + ".user_id").
Group(userTable + ".id")
it becomes something like
test_orders as orders ON test_users.id test_orders.user_id
test_orders as orders ON test_users.id orders.user_id
because of theas
it works if there’s no table prefix
because then the start ends up beingorders as orders
https://github.com/netlify/gocommerce/blob/master/api/user.go#L93