• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

migrations

Migrations in Laravel

June 23, 2015 by Ulysses

Migrations in Laravel is like having version control of your database. It gives you the ability to create, modify and share a schema, as well as drop tables. Since it has version control, you can migrate and rollback your database changes with just a couple of CLI commands. Here’s a couple of examples.

To migrate:

$ php artisan migrate

$ php artisan migrate

To rollback:

$ php artisan migrate:rollback

$ php artisan migrate:rollback

In addition, you can also create a new migration table.

$ php artisan make:migration create_users_table --create="users"

$ php artisan make:migration create_users_table --create="users"

It will create a file similar to this:

app/database/migrations/2015_01_01_213247_create_articles_table.php

which you can modify and add fields.

Filed Under: PHP Tagged With: laravel, migrations

  • Home
  • About
  • Archives

Copyright © 2012–2022