Laravel Database Migration
Make sure you have a database connection with your Laravel Fly App. You can check out our various connection guides on MySQL
, Postgres
, Redis
, and SQLite
.
Once you’re set up with a database connection, there are several ways to run the Laravel classic: “php artisan migrate
” command at Fly.io:
#1 Through the fly.toml
[deploy] configuration ( which will run in every deployment )
[deploy]
release_command = "php /var/www/html/artisan migrate --force"
#2 Through a Start Script in .fly/scripts
:
echo "/usr/bin/php /var/www/html/artisan migrate --force" > ".fly/scripts/db.sh"
#3 Through fly ssh console
shortcut:
fly ssh console -C "php /var/www/html/artisan migrate --force"
#4 Through fly ssh console
:
fly ssh console
cd /var/www/html/
php artisan migrate --force