Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

941
Views
La migración de Knex falló con el error: la consulta está vacía

Actualicé knex de 0.21 a 0.95 siguiendo su guía de migración. Ahora recibo este error en CI cuando se ejecuta npx knex migrate:latest

 migration file "20191104160706_migrate-appsflyer_customers.js" failed migration failed with error: The query is empty at createQueryBuilder (/home/circleci/backend/node_modules/knex/lib/knex-builder/make-knex.js:313:26)

pero el archivo de migración contiene la consulta

 async function up (knex) { // language=Postgres const { rows } = await knex.raw(` SELECT * FROM appsflyer_customer; `) const mappedRows = rows.map(row => ({ user_id: row.user_id, advertising_id_type: 'appsflyer', advertising_id: row.appsflyer_device_id })) await knex('device_advertising_association') .insert(mappedRows) } async function down (knex) { await knex.raw(` DELETE FROM device_advertising_association WHERE user_id NOTNULL; `) } module.exports = { up, down }

Cualquier ayuda sería muy apreciada ya que no llego a ninguna parte con el mensaje de error.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Así que recibí este error desde que Knex 0.95 introdujo una nueva función https://github.com/knex/knex/pull/4289 de modo que si se pasa una matriz vacía para insertar, arrojará un error que no estaba presente antes

y como no usamos esa tabla, estaba vacía y esta migración anterior estaba tratando de insertar una matriz vacía que arrojaba el error en CI, así que básicamente manejé la excepción con un bloque try-catch y se resolvió

entonces, como nota, mire los registros de cambios cuidadosamente

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!