Why is Adonis opinionated about running migrations in production?


#1

Running node ace migration:run in prod, results in:

Cannot run migrations in production

I know there is a --force switch, but I am just wondering what was the reason for making this a default behaviour?

Do people not run migrations in prod? How else would you deploy changes in an automated CI way?


#2

It’s a measure of security to make sure you don’t damage your production database. A lot of frameworks do this to protect the integrity of your data.

As you might know adonis is inspired by Laravel. Read here why they use the --force flag.

https://laravel.com/docs/5.6/migrations#running-migrations


#3

So I have to make changes to the database manually in production?


#4

I use migrations in production, even seed but only with temporary script in package.json that i remove after seed.

I think migration is not so dangerous in production but seed can really mess things up.

 "productionmigration:status": "adonis migration:status",
 "productionmigration:run": "adonis migration:run --force",
 "seedfileXXX": "adonis seed --files='XXX_XXXXX_seeder.js' --force",
 "productionmigration:rollback": "adonis migration:rollback --force",