In Typeorm there is a feature called synchronize
. You can synchronize entities with a database, so there is no need for migirations. But as you know synchronize
is dangerous for production.
Here is the question, when should I use the synchronize
feature? Imagine at first (in the development environment) I started using the synchronize
feature. If I disable it in production while I have no migration, how should my production database will going to be created?
Also, I'm going to deliver the project on some milestones. Should I disable it at the first milestone or at the end? And for long time maintenance, should I use synchronize
disabled and use migration after the first production release?
Any idea would be appreciated.
This was my question too, so I searched for it. I found out that as the documentation says:
Once you get into production you'll need to synchronize model changes into the database. Typically, it is unsafe to use synchronize: true for schema synchronization on production once you get data in your database. Here is where migrations come to help.
We can realize that once you have valuable data in your production database, you should turn synchronization off forever and start using migrations on development and production