sync({alter: true}) throws "Too many keys specified"
See original GitHub issueThis issue is related to #9536
What are you doing?
await sequelize.sync({ alter: true, force: false });
What do you expect to happen?
Sequelize to sync successfully.
What is actually happening?
I get this error: SequelizeDatabaseError: Too many keys specified; max 64 keys allowed. This happens I guess after 64 times of restarting the application.
How did I workaround
There are few things that I can do
- set
force: true. This is not practical for production environment - set
alter: false. This is not practical when my definitions change - set MYSQL key limit, which is makes it hard for cross platform compatibility
- delete all tables, which defeats the point of use
alter. I guess alter creates some indexes which make
Dialect: mysql Database version: XXX Sequelize version: 4.37.10 Tested with latest release: Yes (If yes, specify that version)
Note : Your issue may be ignored OR closed by maintainers if it’s not tested against latest version OR does not follow issue template.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:11
- Comments:36 (3 by maintainers)
Top Results From Across the Web
db.sync({alter:true}).then(); in sequelize node.js express app
The workaround solution is to use string instead of a boolean,. So the old: column: {unique:true, }. becomes: column:{unique:'column'}.
Read more >SearchApiException Too many keys specified; max 64 keys ...
I created a new node index with a lot of fields. When I try to index, I get the message "Couldn't index items....
Read more >Model Basics | Sequelize
User.sync({ alter: true }) - This checks what is the current state of the table in the database (which columns it has, what...
Read more >MariaDB Error Codes
Shared MariaDB/MySQL error codes; MariaDB-specific error codes ... 1069, 42000, ER_TOO_MANY_KEYS, Too many keys specified; max %d keys allowed.
Read more >Hive DDL - Confluence Mobile - Apache Software Foundation
Its recommended that MANAGEDLOCATION be within metastore.warehouse.dir so all ... properties with the new set of properties specified in the ALTER DDL.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
old sequelize use email:{type: Sequelize.STRING, unique: true} Now, email:{type: Sequelize.STRING, unique:‘email’} this will fix the issue.
Here’s workaround that seems to fix it. If you use the approach documented here, it maintains the same index rather than adding a new one each time sequelize syncs. So instead of:
sequelize.define('user', {email: {type: Sequelize.STRING, unique:true}})usesequelize.define('user', {email: Sequelize.STRING}, {indexes:[{unique:true, fields: ['email']}]})