How to Run Migration and Seeder on Laravel Vapor?

About Us:

We are from free coder. We are a group of web developers who are passionate about web development. You can learn from us php, laravel, node js, vue js, react js and many other topic on web developement.
we are very happy to help you.
free coder

Today what you are going to learn:

This simple article demonstrates of how to run migration on laravel vapor. i explained simply about laravel vapor run migration and seeder. we will help you to give lesson of how to run migrations automatically in laravel vapor . i would like to show you laravel vapor migration run lesson. Let's get started with how to run migration and seeder on laravel vapor.

If your app in production then you can not run migration command from vapor website. you must have to run migration from deploy time. laravel vapor provide deploy hook, where you can run migration and seeder command with force.

so let's see both lesson

Run Migration on Vapor:

with deploy hooks:

deploy:

- 'php artisan migrate --force'

vapor.yml

id: 22442

name: freecoder.co-vapor

environments:

production:

memory: 1024

cli-memory: 512

runtime: 'php-8.0:al2'

build:

- 'COMPOSER_MIRROR_PATH_REPOS=1 composer install --no-dev'

staging:

memory: 1024

cli-memory: 512

runtime: 'php-8.0:al2'

database: freecoder.co-vapor-staging

deploy:

- 'php artisan migrate --force'

build:

- 'COMPOSER_MIRROR_PATH_REPOS=1 composer install'

now just deploy it.

php vendor/bin/vapor deploy

Run Seeder on Vapor:

with deploy hooks:

deploy:

- 'php artisan db:seed --class=UserSeeder --force'

vapor.yml

id: 22442

name: freecoder.co-vapor

environments:

production:

memory: 1024

cli-memory: 512

runtime: 'php-8.0:al2'

build:

- 'COMPOSER_MIRROR_PATH_REPOS=1 composer install --no-dev'

staging:

memory: 1024

cli-memory: 512

runtime: 'php-8.0:al2'

database: freecoder.co-vapor-staging

deploy:

- 'php artisan db:seed --class=UserSeeder --force'

build:

- 'COMPOSER_MIRROR_PATH_REPOS=1 composer install'

now just deploy it.

php vendor/bin/vapor deploy

thank you very much for following up with me.

Tags

Recent Posts

Related Posts