Skip to content
Advertisement

Tag: knex.js

Getting A Month’s Worth of Data With KnexJS

I’m trying to get a month’s worth of data using KnexJS, I only have the year and month in the form 20xx-mm. Here’s my Knex query .. The issue is, I’m starting at a specific date and going through to the 31’st day, some months have 30 days, some 28 and 29. How do I go about to creating a

How to add dynamic Where queries in objection.js?

I have a table which has a global search bar that needs to trigger search for all fields like firstName, lastName, email and role. Also have a dynamic filter which can have single or multiple filter like “firstName” or/And “lastName” Obviously they need to be paginated. For pagination i can use Model.query().page(1, 10) But how to supply search or filter.

Knex migration failed with error: The query is empty

I updated knex from 0.21 to 0.95 following their migration guide, Now im geting this Error on CI when its running npx knex migrate:latest but the migration file contains the query’s Any help would be greatly appreciated as im getting no where with the error message Answer So i was getting this error since Knex 0.95 introduced a new feature

How to update a constraint in a migration

I need to add onDelete and onUpdate cascade to a constraint in a migration file. So i did an alter table, selecting the foreign keys and chaining with the alter method in the end of each command. But i’m getting a error saying that the constraint of this relationship already exists. error: constraint “deliveries_courier_id_foreign” for relation “deliveries” already exists How

Advertisement