Running Database Migrations

Problem

You want to run your database migrations.

Solution

Use the php artisan migrate command.

$ php artisan migrate

You'll see a list of what migrations ran.

If you just want to see what would happen if you were to migrate, use the --pretend option.

$ php artisan migrate --pretend

This will show you everything that would happen to your data, but doesn't actually make any changes.

Discussion

You can seed your database too.

Use the --seed option and your database will be seeded after the migrations occur. That is, if you have any seeds set up.

See Seeding Your Database recipe.

comments powered by Disqus

Recommended by us