Skip to content
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

When i need force sync? #21

Closed
kulakowka opened this issue Feb 29, 2016 · 5 comments
Closed

When i need force sync? #21

kulakowka opened this issue Feb 29, 2016 · 5 comments

Comments

@kulakowka
Copy link

I can not understand how works sync method.

I have read the documentation about it. But I do not understand anything. When I have to do the synchronization? Each time when i restart my application it will be deleted all the data from database.

Or should I synchronize only the first time when i run the application and the database table has not yet been created?

But what if the model schema changes? Do i have to synchronize again?

Maybe anyone can share a link to a tutorial and examples?

@ekryski
Copy link
Member

ekryski commented Feb 29, 2016

You don't need force sync. That was actually a bug in the generator. You should not have it in your code. If you see it in the docs please tell me where or do a PR and I will remove it.

@ekryski ekryski closed this as completed Feb 29, 2016
@kulakowka
Copy link
Author

I have not seen this in the documentation. It seems that I generated application using the old generator.

@kulakowka
Copy link
Author

The latest version of generator adds this code in every model:

user.sync();

Why we do this for each model instead sequelize instance?

sequelize.sync()

@ekryski
Copy link
Member

ekryski commented Feb 29, 2016

@kulakowka I didn't know you could do that. Looks like you can do either one. The choice is yours... 😄

@kulakowka
Copy link
Author

Yes thank you. I've already figured out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants