-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not synchronize by default? #627
Comments
It's still related? |
I think there's something wrong in the following code: sequelize/lib/sequelize-core.module.ts Line 155 in f93e517
Here: if (typeof options.synchronize === 'undefined' || options.synchronize) {
await sequelize.sync(options.sync);
} I think it should be: if (typeof options.synchronize === 'undefined' || options.synchronize) {
await sequelize.sync(options.synchronize);
} Following Sequelize's manual here:
So that, if in nestjs/sequelize we find I would amend it myself, but it'd feel safer if a contributor checks this supposition of mine. |
Hi @kamilmysliwiec, can we see where the commit for this fix is? Thanks! |
I'm submitting a...
Current behavior
Not explicitely providing the
synchronize: false
option to the module calls thesequelize.sync()
method which can alter a database in unexpected ways.Expected behavior
Not explicitely providing the
synchronize
option shouldn't call thesequelize.sync()
method.What is the motivation / use case for changing the behavior?
I believe having the
synchronize
option enabled by default can be quite unforgiving if forgotten or omitted as this isn't a sequelize default behaviour (you have to explicitely callsequelize.sync()
) and would be safer for projects relying on another database syncing mechanism (migrations, etc.).Also the documentation doesn't appear really clear to me (keeping both original
sync
option and the newsynchronize
option).Thanks for the consideration!
The text was updated successfully, but these errors were encountered: