- Introduction:
- Migrations are like version control for your database, allowing your
team to easily modify and share the application's database schema.
- The Laravel
Schema facade provides database agnostic support for creating and manipulating tables across all of Laravel's supported database systems.
- Generating Migrations
- Create a migration:
Ex: The
--table and
--create options may also be used to indicate the name of the table and whether the migration will be creating a new table.
php artisan make:migration create_users_table --create=users
php artisan make:migration add_votes_to_users_table --table=users
- Migrations Structure
- A migration class contains two methods:
up and down. The up method is used to add new tables, columns, or indexes to your database, while the down method should reverse the operations performed by the up method.
- Running Migrations
- To run all of your outstanding migrations, execute the
migrate Artisan command:
- Rollback Migrations
- Tables
- Column
- Indexs
No comments:
Post a Comment