#15888·sequelize

sequelize.sync({ hook: true }) uses ALTER on each column taking forever

Author: mschipperheynCreated Apr 2, 2023Updated Sep 23, 2026

Issue Creation Checklist

  • [x ] I understand that my issue will be automatically closed if I don't fill in the requested information
  • [ x] I have read the contribution guidelines

Bug Description

I use the sync command to basically automatically create new tables on my environment, including in production. I use migrations for any subsequent change.

Recently, I believe sync({ hooks: true }) behavior has changed. Instead of simply checking for the existence of a table and creating if if it doesn't exist, which is what I want, it goes through each column in each table and issues an ALTER statement.

It takes forever and leads to timeouts on my environment. This looks like a regression to me but if it isn't, it's not really clear from the documentation how to get the original behavior since alter: false is the default.

Reproducible Example

What do you expect to happen?

I expect table creation if not exists and nothing else.

What is actually happening?

It goes over each and every column for each table and issues an ALTER statement leading to timeouts during initialization.

Environment

  • Yes, I have the time and I know how to start.
  • Yes, I have the time but I will need guidance.
  • No, I don't have the time, but my company or I are supporting Sequelize through donations on OpenCollective.
  • [ x] No, I don't have the time, and I understand that I will need to wait until someone from the community or maintainers is interested in resolving my issue.

Indicate your interest in the resolution of this issue by adding the reaction. Comments such as "+1" will be removed.