mikro-orm: Schema generator crash after update from 4.2.1 to 4.2.3

Describe the bug Schema generator crash after update from 4.2.1 to 4.2.3

Stack trace

TypeError: Reduce of empty array with no initial value
    at Array.reduce (<anonymous>)
    at SchemaBuilder.Target.toQuery (/home/alejandro/Proyectos/tattoo-latest/server/node_modules/knex/lib/interface.js:14:8)
    at SchemaGenerator.dump (/home/alejandro/Proyectos/tattoo-latest/server/node_modules/@mikro-orm/knex/schema/SchemaGenerator.js:485:29)
    at SchemaGenerator.getCreateSchemaSQL (/home/alejandro/Proyectos/tattoo-latest/server/node_modules/@mikro-orm/knex/schema/SchemaGenerator.js:46:25)
    at Function.handleSchemaCommand (/home/alejandro/Proyectos/tattoo-latest/server/node_modules/@mikro-orm/cli/commands/SchemaCommandFactory.js:70:44)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

To Reproduce Steps to reproduce the behavior:

  1. Upgrade from 4.2.1 to 4.2.3
  2. execute npx mikro-orm schema:create -d

Expected behavior That Schema generator continue working after upgrade.

Versions

Dependency Version
node 14.14.0
typescript 4.0.3
mikro-orm 4.2.3
your-driver mysql

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 17 (14 by maintainers)

Commits related to this issue

Most upvoted comments

@B4nan I’ll take a look tonight, thanks!

Released in knex 0.21.8, could someone confirm if published knex version resolves issue for them?

The issue is caused by update of knex on the downstream (or upstream? idk :]). Many ORM tests are failing when I upgrade knex to latest. As I said, I locked the dependencies, so this won’t happen anymore, and downsteam will always use the versions that are in the ORM lockfile.

Ok, this is caused by the latest knex update. When I update knex to from 0.21.6 to 0.21.7 I can observe the same in the ORM tests. So in fact your issue is not upgraded MikroORM, but upgraded knex.

I guess I should pin the dependencies…