Categories
Laravel Samuel

Migrate Refresh & Seed With Envoyer

We have been test driving Envoyer and ran into a bit of a stumbling block this week. We have a staging site that we setup to auto deploy with Envoyer. As part of our auto deploy we wanted to run

php artisan migrate:fresh --force --seed

To start we added that code to the Envoyer deployment hook section but it kept spitting out this error when it executed

Could not open input file: artisan

So we realized ok we must be in the wrong location on the server when Envoyer executes this command. It took a little bit of trial and error but we got it working with this:

cd ~/home-directory/current

php artisan migrate:fresh --force --seed

**Replace home-directory above with your real path, so for us we got this by SSHing into the server, and then navigating to the public web directory. If you are using forge this will be super easy as it will be one folder typically named with the URL of your site