mysqlnode.jssails.js

Node.js auto migrations


I have been doing Django for several years and was spoiled by their automigrations that they have supported for a very long time. Recently I started using SailsJS (which I am very new to) and noticed that it only supports alter for db migrations in development, NOT production. Is there any third party for node that does something to that effect? I looked at knex but that doesn't autodetect the changes made to my models. I'm looking for something similar to what Django has.

I read the below thoroughly:

https://sailsjs.com/documentation/concepts/models-and-orm/model-settings#?migrate


Solution

  • TypeORM does this with {sync: true} setting. It also supports JS projects. What I like about it is that it does only safe automigrations, it adds columns and tables, but never drops them. So, 90% of migrations are automatic, you only need to be explicit about unsafe operations and create migrations manually.