I'm using Laravel and as part of my deploy routine I have the command
RUN php artisan migrate
Since I'm in production, I get the error
Application in production, Command Cancelled!
The fix is easy: RUN php rankbot/artisan migrate --force
but I feel this is not the right way to do it? What's the best way to ensure the DB schema is always up to date?
This is the right way to go about it.
When you run a migration on production, you best be sure what it's going to do to your database, as some actions might not be rollbackable.
The confirmation prompt is there to make you stop and think twice before potentially cause harm.
Some migration operations are destructive, which means they may cause you to lose data. In order to protect you from running these commands against your production database, you will be prompted for confirmation before the commands are executed. To force the commands to run without a prompt, use the --force flag