Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

The db:migrate command fails "Unknown structure passed to order/group: Literal { val: ' ASC' }."

Open
#692 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
mysql, node.js, typescript
Domain
backend, database

Research direction

Start with lib/dialects/abstract/query-generator.js, especially quote and getQueryOrders, and compare the reported Sequelize 6.37.3 behavior with the failing db:migrate command. Use the stack trace and final SELECT against SequelizeMeta to trace how the ORDER BY direction is formed. Done means db:migrate completes and the generated query no longer ends with undefined.

Written by the indexing model from the issue text.

Description

I've encountered an issue after upgrading Sequelize from version 4.28.0 to 6.37.3. The db:migrate command fails with the following error message: "Unknown structure passed to order/group: Literal { val: ' ASC' }."

Here’s the exception log and stack trace:

Executing (default): SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = 'example_db';
Executing (default): SHOW FULL COLUMNS FROM `SequelizeMeta`;
Executing (default): SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE TYPE = 'BASE TABLE' AND TABLE_NAME = 'SequelizeMeta' AND TABLE_SCHEMA = 'example_db';
Executing (default): SHOW INDEX FROM `SequelizeMeta`;
Error: Unknown structure passed to order/group: Literal { val: ' ASC' }
    at MySQLQueryGenerator.quote (/node_modules/sequelize/lib/dialects/abstract/query-generator.js:690:13)
    at MySQLQueryGenerator.<anonymous> (/node_modules/sequelize/lib/dialects/abstract/query-generator.js:676:21)
    at Array.forEach (<anonymous>)
    at MySQLQueryGenerator.quote (/node_modules/sequelize/lib/dialects/abstract/query-generator.js:675:27)
    at MySQLQueryGenerator.getQueryOrders (/node_modules/sequelize/lib/dialects/abstract/query-generator.js:1586:34)
    at MySQLQueryGenerator.selectQuery (/node_modules/sequelize/lib/dialects/abstract/query-generator.js:1025:27)
    at MySQLQueryInterface.select (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:407:59)
    at SequelizeMeta.findAll (/node_modules/sequelize/lib/model.js:1140:47)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Executing (default): SELECT `name` FROM `SequelizeMeta` AS `SequelizeMeta` ORDER BY `SequelizeMeta`.`name`undefined;

The issue seems to stem from the quote function in lib/dialects/abstract/query-generator.js. The expected result is that undefined should be resolved to ' ASC', but instead, it's being interpreted as Literal { val: ' ASC' }. This leads to an invalid SQL query, as shown in the final line of the log.

Any guidance on how to resolve this issue would be greatly appreciated.

umzug: ^2.3.0
sequelize: 6.37.3
sequelize-cli: 6.6.2
storage: SequelizeStorage
node: v16.20.2
dev setup: typescript

Dominant language
TypeScript
Stars
2.2k
Forks
162
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sequelize/umzug

All issues in sequelize/umzug

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.