06.10.2016 Views

laravel-5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Database: Migrations 539<br />

24 * Reverse the migrations.<br />

25 *<br />

26 * @return void<br />

27 */<br />

28 public function down()<br />

29 {<br />

30 Schema::drop('flights');<br />

31 }<br />

32 }<br />

Running Migrations<br />

To run all outstanding migrations for your application, use the migrate Artisan command. If you<br />

are using the Homestead virtual machine, you should run this command from within your VM:<br />

1 php artisan migrate<br />

If you receive a “class not found” error when running migrations, try running the composer dumpautoload<br />

command and re-issuing the migrate command.<br />

Forcing Migrations To Run In Production<br />

Some migration operations are destructive, meaning they may cause you to lose data. In order to<br />

protect you from running these commands against your production database, you will be prompted<br />

for confirmation before these commands are executed. To force the commands to run without a<br />

prompt, use the --force flag:<br />

1 php artisan migrate --force<br />

Rolling Back Migrations<br />

To rollback the latest migration “operation”, you may use the rollback command. Note that this<br />

rolls back the last “batch” of migrations that ran, which may include multiple migration files:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!