From the course: Laravel Essential Training
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Creating and running migrations - Laravel Tutorial
From the course: Laravel Essential Training
Creating and running migrations
Using the database client extension or any other GUI tool, we can create tables manually. Like you can click on create a new table and so on. But in production, creating tables manually is definitely not the best approach. Migrations in Laravel help creating and modifying table structures, acting like version control. So let's create a new student's table using migrations. Open terminal and type the command php artisan make:migration and specify the name of the migration like let's say create_students_table. This could be any name, but this particular name will help Laravel understand that you're trying to create a student's table. Hit "Enter". The migration is created for us. It's within the database directory and migrations. We use the schema facade to create and modify tables. You can see two methods here, up and down. The up method is used to create a table or column, while the down method is used to drop the table or column in case of rollback. The create method of schema facade…
Contents
-
-
-
-
Understand Laravel configuration3m 53s
-
(Locked)
Working with the database6m 3s
-
(Locked)
Creating and running migrations3m
-
(Locked)
Creating models and using Eloquent4m 12s
-
(Locked)
Challenge: Create a migration to add a column and update a row52s
-
(Locked)
Solution: Create a migration to add a column and update a row3m 2s
-
-
-
-
-
-
-