Skip to main content

All Questions

Tagged with
0 votes
0 answers
12 views

knex: use common knex object to switch schema ".withSchema"

I have a multitenant environment where I maintain different schemas for different clients. To manage this setup I have a utility that returns me a knex object based on the identifier in the request. ...
Vivek Molkar's user avatar
  • 3,950
-1 votes
1 answer
399 views

How to securely connect Knex to RDS

I have a NodeJS application using Objection and Knex libraries connecting to a MySQL database in AWS RDS. I am able to connect to it with knex if I set up the knex file with the proper accessibility ...
metalwing1212's user avatar
0 votes
1 answer
340 views

Why am I getting this error: migration failed with error: Cannot read properties of undefined (reading 'createTable')

LOG npx knex migrate:latest migration file "20230917031623_createUsers.js" failed migration failed with error: Cannot read properties of undefined (reading 'createTable') Cannot read ...
Esdras's user avatar
  • 1
0 votes
2 answers
22 views

I'm trying to make loginform check using knex but it doesn't work

My Code: function checkLogIn() { var emailValue = document.getElementById("emails").value; var usernameValue = document.getElementById("username").value; var passwordValue = ...
StackOverflAXEL's user avatar
0 votes
2 answers
55 views

In knex what is the difference between knex().select("id").from("users) and knex("users").select("id")

/I've already established a connection in knex with mysql and i am trying to do a loginForm connected to mysql db and right now i am doing a login check.I was wondering if there is any difference ...
StackOverflAXEL's user avatar
0 votes
2 answers
133 views

ExpressJs and MySQL - Better alternatives for Knex Interceptor for Encrypting Decrypting database table fields

I have a list of sensitive fields that needs to encrypted before inserting into my MySQL tables, and decrypt them post retrieving it. I thought of the following ways to implement this. Implement a ...
AKA's user avatar
  • 6,355
1 vote
1 answer
413 views

Knex with RDS proxy connection timeout

I want to use Knex as a query builder with a database connection managed by an RDS proxy. I am using mysql2 as my database driver, which works as expected: const connection = await mysql2....
Matt Saunders's user avatar
1 vote
1 answer
141 views

Convert mysql query to its equivalent Knex query

I am trying to convert my mysql query to its equivalent Knex query Here is the query CREATE TABLE test ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(100), unique (id) ) AUTO_INCREMENT = 1001;...
Tony Stark's user avatar
0 votes
0 answers
156 views

Using MySQL JSON array field to join on a table in knex

i have two tables slots and bookings. In bookings table i have slots column stored as json array (as shown in figure) [![enter image description here][1]][1] I need to to get, each slots data when i ...
salih kallai's user avatar
0 votes
2 answers
485 views

How to validate so I would get message saying username already exists if I enter same username?

exports.signup = async (req, res) => { const { username, password, name } = req.body; // TODO: Validate if username exists await knex("users").insert({ username, password, name }...
Gin Ichimaru's user avatar
0 votes
1 answer
676 views

Node.js refusing to connect to MySQL Docker container using knex [duplicate]

I am trying to build an application using docker and MySQL but I am not able to connect to the MySQL container through Node.js. I don't know if using knex is causing this but the error is ECONNREFUSED....
NevinTroy's user avatar
0 votes
1 answer
117 views

Why is Knex not able to insert into mysql?

I am trying to insert a row of values into MySQL database using Knex but I am getting a weird error. The table and database exist and the fetch API works perfectly but I am not able to insert values ...
NevinTroy's user avatar
0 votes
2 answers
283 views

Knex.js and NodeJS - Dynamic Endpoints for Select, Insert, Delete, Update

Currently moving a web application over to using Knex to help with issues to do with SQL injection. Knex has helped us to stop the issue of running different and new queries however we have a point of ...
Vacation's user avatar
2 votes
1 answer
2k views

Query using Knex - withGraphFetched and where clause

I need to search the database using Knex, returning only sales in a given city. For this, I have two tables: sale: id drugstore_id drugstore: id name city My models: class Sale extends Model { ...
Fred's user avatar
  • 202
0 votes
0 answers
29 views

MySQL add in bulk by passing data in argument for procedure

after searching for a while I could not find a way to add rows in bulk by passing in argument for example a list of values. I know that it is possible to create a for loop, but it would insert each ...
Nazarii Horchytsia's user avatar

15 30 50 per page
1
2 3 4 5
15