I'm trying to deploy a Laravel website in production mode. The site is currently deployed, but I've added a database and some migrations plus seeds, and the deployment for the migrations is failing.
The logs are showing me that the Migrations fail because the production mode brings up a prompt that says
Migrating the database tables into your application
**************************************
* Application In Production! *
**************************************
Do you really wish to run this command? (yes/no) [no]:
>
Aborted
I've tried working around this by piping "yes" into the migration command in my deploy script, but it did't work. Presumably I could change the mode to NOT production, but I don't think that's an appropriate fix here. I also tried using the "--force" flag for migrations but it didn't prevent the warning.
deploy script
cd /home/forge/default
git pull origin master
npm install --save-dev cross-env
npm install
composer require nesbot/carbon:1.26.3
composer require tcg/voyager
composer install --no-interaction --prefer-dist --optimize-autoloader
npm run development
echo "" | sudo -S service php7.2-fpm reload
if [ -f artisan ]
then
php artisan config:cache
php artisan voyager:install
php artisan migrate --force
php artisan db:seed --class=CategoriesTableSeeder --force
php artisan db:seed --class=UsersTable --force
php artisan db:seed --class=BlogPostsTableSeeder --force
fi
Does anyone know how I can disable this warning in production or why the force option isn't suppressing this warning so I can run the migrations?
Thanks!
You could try the --no-interaction flag as well, but it looks like what you have there (--force) is right. Are you sure nothing else is running your migration, for instance does voyager:install auto-run migrations, or post-install script in composer?
Also just interested, why you are installing packages in your Forge deployment script. They should be included in the repo in the package.lock or composer.lock files so you just need to run install.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With