The db:migrate command fails "Unknown structure passed to order/group: Literal { val: ' ASC' }."
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
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sequelize/umzug
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Security Vulnerability: ajv (JSON Schema Validator)Possibly taken @claabs claimed this 239 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 40/100
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Similar issues
-
area:cli bug P4
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug from-studio
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
esengine/DeepSeek-Reasonix#14868 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
linxiv-dev/linXiv#384 · 1 comment ·
Maintainers usually reply within 1 day
-
factory-active task-identify-harness-labels-done task-identify-issue-type-done
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day