2 months ago

Forge: script for adding column to production database table

Posted 2 months ago by trevorpan

Was reading this post below and feel I have a good understanding of the process of creating a new migration which then adds a column to an existing table. I know I'll have to test the nullable or default values for previous users, e.g. to ensure there are no errors.

This doc: states you need to add this dependency composer require doctrine/dbal. I've done that locally.

When I get ready to push this to production does the below script cover this dbal?

It seems like a yes, as it's in the composer.json which would be pushed to master, but it's not something I want to get wrong.

cd /home/forge/
git pull origin master
composer install --no-interaction --prefer-dist --optimize-autoloader
php artisan config:cache -q --no-interaction
php artisan route:cache
npm run production
echo "" | sudo -S service php7.1-fpm reload

if [ -f artisan ]
    php artisan migrate --force

Thank you for any tips..

Please sign in or create an account to participate in this conversation.