javascript – Como salvar uma variável, em um campo da tabela do banco de dados MySQL, ADONIS FRAMEWORK LUCID ORM

salve salve!

Preciso salvar a variável que pego no request body da função. Que é o cellphone , em salvar seu valor um campo da minha tabela do banco de dados, que também se chama cellphone

Estou usando o Nodejs, Adonis Framework, ORM KNEX/Lucid, usando a função nativa da biblioteca:

merge e save

Tentei de algumas foramas.Porém ainda sem sucesso.

Poderia me dar um help? Acabei me enrolando. Grato pela ajuda!


//REGISTER CELLPHONE CLIENT
  async registerCellphone({ request, response }) {
    try {
    

          const { email, cellphone } = request.body;
      const user = await User.findBy("email", email);
     
      console.log(user.username);
      console.log(cellphone);

      if (!email)
        return response.status(400).send({ error: "Email not found" });

      if (!cellphone)
        return response.status(400).send({ error: "Cellphone not found" });
      

      if (user) {
        user.merge({
          cellphone: cellphone,
        });

        //SAVE DATAS
        await user.save();
      }

      response.status(200).send({
        Success: "Your token and information has been sent to your SMS number",
      });

    } catch (err) {
      console.log(err);
      response.status(400).send({ error: "Cannot reset password, try again" });
    }
  }

Retorno do erro:


info: serving app on http://127.0.0.1:3333
Guiller
+5521999999124
Error: ER_WARN_DATA_OUT_OF_RANGE: Out of range value for column 'cellphone' at row 1
    at Query.Sequence._packetToError (C:SOFTWARE@JOBSsingular_storenode_modulesmysqllibprotocolsequencesSequence.js:47:14)
    at Query.ErrorPacket (C:SOFTWARE@JOBSsingular_storenode_modulesmysqllibprotocolsequencesQuery.js:79:18)
    at Protocol._parsePacket (C:SOFTWARE@JOBSsingular_storenode_modulesmysqllibprotocolProtocol.js:291:23)
    at Parser._parsePacket (C:SOFTWARE@JOBSsingular_storenode_modulesmysqllibprotocolParser.js:433:10)
    at Parser.write (C:SOFTWARE@JOBSsingular_storenode_modulesmysqllibprotocolParser.js:43:10)
    at Protocol.write (C:SOFTWARE@JOBSsingular_storenode_modulesmysqllibprotocolProtocol.js:38:16)
    at Socket.<anonymous> (C:SOFTWARE@JOBSsingular_storenode_modulesmysqllibConnection.js:88:28)
    at Socket.<anonymous> (C:SOFTWARE@JOBSsingular_storenode_modulesmysqllibConnection.js:526:10)
    at Socket.emit (events.js:200:13)
    at addChunk (_stream_readable.js:294:12)
    at readableAddChunk (_stream_readable.js:275:11)
    at Socket.Readable.push (_stream_readable.js:210:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:166:17)
    at Protocol._enqueue (C:SOFTWARE@JOBSsingular_storenode_modulesmysqllibprotocolProtocol.js:144:48)
    at Connection.query (C:SOFTWARE@JOBSsingular_storenode_modulesmysqllibConnection.js:198:25)
    at C:SOFTWARE@JOBSsingular_storenode_modulesknexlibdialectsmysqlindex.js:144:18
From previous event:
    at Client_MySQL._query (C:SOFTWARE@JOBSsingular_storenode_modulesknexlibdialectsmysqlindex.js:135:12)
    at Client_MySQL.query (C:SOFTWARE@JOBSsingular_storenode_modulesknexlibclient.js:192:17)
    at Runner.<anonymous> (C:SOFTWARE@JOBSsingular_storenode_modulesknexlibrunner.js:138:36)
From previous event:
    at C:SOFTWARE@JOBSsingular_storenode_modulesknexlibrunner.js:47:21
    at processImmediate (internal/timers.js:439:21)
From previous event:
    at Runner.run (C:SOFTWARE@JOBSsingular_storenode_modulesknexlibrunner.js:33:30)
    at Builder.Target.then (C:SOFTWARE@JOBSsingular_storenode_modulesknexlibinterface.js:23:43) {
  code: 'ER_WARN_DATA_OUT_OF_RANGE',
  errno: 1264,
  sqlMessage: "Out of range value for column 'cellphone' at row 1",
  sqlState: '22003',
  index: 0,
  sql: "update `users` set `cellphone` = '+5524999899424', `created_at` = '2020-12-31 19:09:39', `updated_at` = '2020-12-31 20:00:35' where `id` = 21"
}